2

Ive been reading everywhere on how to do this, and I understand how to do it, but for some reason I cannot get it to work correctly.

I simply want to run a jar file on restart or boot, the jar file is a server bot for teamspeak3, and its basically needs to run after teamspeak has started.

The code I want to run on boot is

screen -d -m -S ts3bot java -jar JTS3ServerMod.jar

file name and location for the .conf:

$ cat /etc/init/serverbot.conf
description "serverbot"  
author "Peter"  

start on runlevel [3]  
stop on shutdown  

expect fork  

script  
   cd /home/teamspeak/sbot
   screen -d -m -S ts3bot java -jar JTS3ServerMod.jar >/var/log/sbot.log 2>&1  
   emit serverbot_running  
end script 

when I run the code as root this is what i get

$ start serverbot
start: Job failed to start

I then go into logs @ /var/log/upstart I see this

/proc/self/fd/9: 2: cd: can't cd to /home/teamspeak/sbot

If i change cd to chdir I still get the same results. the folder /home/teamspeak/sbot does exist

Anyone know what could be causing this? Ownership issues? When upstart runs the .conf, under what user is it run? I don't understand whats going on here.

root@fister4:/# namei -mo /home/teamspeak/sbot
f: /home/teamspeak/sbot
 drwxr-xr-x root      root      /
 drwxr-xr-x root      root      home
 drwxr-xr-x teamspeak teamspeak teamspeak
 drwxr-xr-- teamspeak teamspeak sbot
Zanna
  • 72,312

1 Answers1

2

I changed

cd /home/teamspeak/sbot

To

cd /home/teamspeak/sbot/

And it loaded into the directory correctly without an error