#!/bin/bash
cd /opt/minecraft-player
exec 2>&1
exec setuidgid minecraft /usr/bin/java -Xmx2048M -Xms1024M -jar /opt/minecraft-player/server.jar --nogui --port 32122
and logging: #!/bin/bash
exec multilog s10485760 n5 /var/log/minecraft-player
Logging is set for 10MB files, keep last 5.The first one goes into a servicename/run file, and the second into servicename/log/run.
Running the run file is precisely what the daemontools system will do. There's no need to track the PID. `svstat servicename` will tell you how long it's been running or if it's disabled. The default is to restart on death, and if it flickers too much, disable it. Adding /etc/init.d wrappers to this is a 60 second edit of a skeleton file.
Code is superior to configuration when the code is this simple.