#!/bin/sh
cd ${HOME}/CURRENT/
nohup ./startserver.sh -configfile=serverconfig.xml &>/dev/null &
The one to stop the server needs the servers telnet access:
Code:
#!/usr/bin/expect
set timeout 20
spawn telnet localhost <YOUR TELNET PORTNUMBER>
expect "Please enter password:"
send "<YOUR TELNET PASSWORD>"
expect "Press 'help' to get"
send "shutdown\r"
sleep 15
send "exit\r"
If you want to restart immediately after a crash, crontab naturally won't help that much. In that case you need some script checking if the server is still running aka a watchdog that then calls the start script.
There are also at least 2 server managers from modders available that probably do this type of thing as well.