OPTIONS="java -Xms1024M -Xmx1024M -jar craftbukkit.jar"
PROCESS=server01
screen -dmS $PROCESS $OPTIONS nogui # Starting the application
screen -x $PROCESS -X stuff `printf "stop\r"` # Closing the application
screen -x $PROCESS # Attaching to the terminal of the application
The problem I'm facing with is that "-X stuff `printf "stop\r"`" Doesn't work if the process has never been "screen -x $PROCESS" (attached to the screen and then Ctr-A-D)
So is there a way to make "stuff" work without that the screen has to be attached once?
Not sure from the man page what -d does for you, or -m, but I a more an xterm guy, not haveing doen screens since the bad old days. I hope nogui is for your jad'd java app, and that it is expecting to read your string 'stuff stop\r'.
-X Send the specified command to a running screen session. You can
use the -d or -r option to tell screen to look only for attached
or detached screen sessions. Note that this command doesn't work
if the session is password protected.
So try -d and see if it lets you get away without attaching.