PC Create an automatic server restart 7 days to die in Linux (console)

deivik

Refugee
I am looking for how to put an auto restart on my server 7 days to die in linux, either due to a crash or that every 12 hours it restarts itself

Thanks in advance, regards

 
I use two scripts that I call in crontab:

One to start a server is rather trivial:

Code:
#!/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.

 
Last edited by a moderator:
Back
Top