How do I start a screen session using an upstart job with a non privileged user?
6
votes
3
answers
6075
views
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 )
stop on runlevel
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"
Asked by Riley Tench
(81 rep)
Jun 23, 2014, 10:20 PM
Last activity: Apr 6, 2019, 01:26 AM
Last activity: Apr 6, 2019, 01:26 AM