Jump to content

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


deivik

Recommended Posts

I use two scripts that I call in crontab:

 

One to start a server is rather trivial:

#!/bin/sh

cd ${HOME}/CURRENT/
nohup ./startserver.sh -configfile=serverconfig.xml &>/dev/null &

 

The one to stop the server needs the servers telnet access:

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

 

Edited by meganoth (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...