[Durham] Setting a command as a startup service?

Martin Ward martin at gkc.org.uk
Wed Dec 11 09:15:27 UTC 2013

On Tuesday 10 Dec 2013 at 23:42, Richard Patterson <richard at helpquick.co.uk> 
> Hard to type all on phone...
> 'which java' will give you the full path to the java executable.
> You'll also need to specify path to the minecraft jar file too (eg
> /root/minecraft.jar)
> Please remember that it'll be running as root of course.

To run as a user instead of as root:

sudo user java -Xmx780M -Xms780M -jar minecraft_server.1.7.3.jar nogui

where "user" is the username to run as.

Also, if you are adding this line to /etc/rc.local, you need to add an "&"
to make it run in the background:

sudo user java -Xmx780M -Xms780M -jar minecraft_server.1.7.3.jar nogui &

You might want to add a log file to capture the output:

sudo user java -Xmx780M -Xms780M -jar minecraft_server.1.7.3.jar nogui 2>&1 > 
/home/user/minecraft.log &


Dr Martin Ward STRL Principal Lecturer and Reader in Software Engineering
martin at gkc.org.uk  http://www.cse.dmu.ac.uk/~mward/  Erdos number: 4
G.K.Chesterton web site: http://www.cse.dmu.ac.uk/~mward/gkc/
Mirrors:  http://www.gkc.org.uk  and  http://www.gkc.org.uk/gkc

More information about the Durham mailing list