Forum

> > CS2D > Servers > Auto restart server in Shut down
Forums overviewCS2D overview Servers overviewLog in to reply

English Auto restart server in Shut down

6 replies
To the start Previous 1 Next To the start

old Re: Auto restart server in Shut down

KimKat
GAME BANNED Off Offline

Quote
You can write a Bash script to check if the server is running and do a couple more checks with a socket check program to see if the server is online. If the server isn't online then re-launch the server. It's not that difficult to write in Bash all you really need is to learn AWK which is a basic Linux scripting language which can simplify things for you greatly. All it takes is just to learn it and you'll be good to go.

old Re: Auto restart server in Shut down

TopNotch
User Off Offline

Quote
It's pretty easy if you know some Bash.
You can use this condition to determine whether a process is running or not (there are other ways though):
1
2
3
4
5
6
if ps aux | grep "CounterStrike2D.exe" > /dev/null
then
	echo "Running"
else
    echo "Stopped"
fi

old Re: Auto restart server in Shut down

sheeL
User Off Offline

Quote
1 - Open your putty
2 - Type;

1
2
3
vi cron.sh
(paste the code)
Press CTRL + C (one time) and type :wq to save
3 - When you save, type on your terminal
1
chmod 755 cron.sh

It's a example for save the file and set the permissions, but @user TopNotch: script won't restart your server when crash, just an example.

old Re: Auto restart server in Shut down

KimKat
GAME BANNED Off Offline

Quote
These scripts I've written are working pretty good.
Code >
To the start Previous 1 Next To the start
Log in to reply Servers overviewCS2D overviewForums overview