I am trying to create an Upstart job that starts a new screen
session on boot, in which I would like to automatically start a java
executable. Here is the .conf file I am currently trying to get to work, although I have tried several others:
description "Run the bungeecord jar"
start on (local-filesystems and net-device-up IFACE=eth0 and runlevel [2345])
stop on runlevel [016]
exec start-stop-daemon --start -c ridog --exec /usr/bin/screen -- -dmUS BungeeCord java -server -XX:UseSSE=4 -XX:+UseCMSCompactAtFullCollection -XX:MaxPermSize=356m -XX:ParallelGCThreads=6 -XX:+UseConcMarkSweepGC -XX:+DisableExplicitGC -XX:+CMSIncrementalMode -XX:+CMSIncrementalPacing -XX:+UseCompressedOops -XX:+AggressiveOpts -Xmx256M -jar BungeeCord.jar
pre-stop script
screen -S BungeeCord -X foo "end^M"
end script
To my knowledge, the script seems to work fine, I can run sudo start bungeecord
and get the intended result, however, restarting the machine does not work. Instead, I get this error in the /var/log/upstart/bungeecord.log
:
Cannot make directory '/var/run/screen': Permission denied
I've looked up this error and the search results are obscure and inconclusive. I've tried running the command as root, this removes the error but still no screen
session. I've tried different commands like this:
su ridog -c "screen -dmS BungeeCord java -jar /home/ridog/BungeeCord/BungeeCord.jar"
screen
session isn't started asroot
? Please start a program inscreen
that way that cannot fail (likesleep 1000
). – Hauke Laging Jun 23 '14 at 22:44screen -dmS test sleep 1000
. No screen sockets running in both the root account and my own upon reboot. However, no errors in the log. – Riley Tench Jun 23 '14 at 23:13screen -dmS test sleep 1000
viacrontab
then there is the expected screen session. Trying withcron
may be easier for you anyway. – Hauke Laging Jun 24 '14 at 01:30