View Full Version : Linux-Server Autorestart on Shutdown
General.Jung
08-15-2007, 07:10 PM
Hello Forum,
how can I force the server to restart when any errors have shut it down?
foobar
08-15-2007, 10:34 PM
Write a bash-skript.
General.Jung
08-15-2007, 10:40 PM
Hello foobar,
Write a bash-skript.
Thanks for your reply. That will be other way! But is there no way for a internal process watch?
foobar
08-15-2007, 11:20 PM
as far as i can tell, not in q3, d3, prey and q4 so i think it'll be the same in etqw - but whats the problem about writing a script? I like it more this way, ok the hl / source autorestart is simple and easy but you cant control or log it for example.
General.Jung
08-15-2007, 11:34 PM
Hello foobar,
nothing, but it would be more usefull if there is a watchdog, as check every few seconds the processes.
foobar
08-16-2007, 12:03 AM
Would be nice to have but who would use this?
The professional hosters will have their own systems for all servers and not only for this game, and it would be bs if every game came with its own watchdog-system + own api etc.
Then there are the private hosters which host their servers on their roots, i think most of them won't care about such a thing, and these who care write a little script and are happy.
So imho it's not worthy and productive to code it in the main-application.
sponge
08-16-2007, 07:03 AM
So imho it's not worthy and productive to code it in the main-application.
I would go even further and say it's not even the dedicated server's problem to ensure that it is running in the first place.
Definitely agreed, the last thing we need is every game launching it's own stupid little daemon when you could have a global one for as many processes as you want.
foobar
08-16-2007, 09:04 AM
I would go even further and say it's not even the dedicated server's problem to ensure that it is running in the first place.
Of course I was talking about the dedicated Server when i said "main-application" ;)
Kamikazee
08-16-2007, 12:06 PM
Depending on the Linux flavour you are hosting, you could also make a startup script. They can be a little esoteric at first, but the init daemon should guarantee the process gets restarted in case the server is shut down.
Your best option is to base it on an existing startup-script, eg. one for a Quake 3 server.
escapedturkey
08-18-2007, 06:51 AM
cd ~/quakewars
quakewarscron
*/10 * * * * ~/run_quakewars.bsh >/dev/null 2>&1
run_quakewars.bsh
#!/bin/bash
serverpid=`ps ux | grep etqwded.x86 | grep -v grep`
if [ -z "$serverpid" ]; then
crontab ~/quakewars/quakewarscron
cd ~/quakewars
rm -f nohup.out
nohup ./etqwded.x86 +set net_serverDedicated 1 +set in_tty 0 +set net_ip IP-address +set net_port 27733 +set fs_basepath /home/username/quakewars +set fs_savepath /home/username/quakewars +set fs_devpath /home/username/quakewars +set net_serverPunkbusterEnabled 1 +set fs_game "" +set fs_game_base base +exec server.cfg &
fi
exit 0
#EOF
Start QuakeWars:
chmod +x run_quakewars.bsh
./run_quakewars.bsh
Stop QuakeWars:
killall etqwded.x86 && crontab -r
masta-
08-22-2007, 11:44 AM
here is my tiny startscript:
start.sh:
!#/bin/bash
while [ "1" ]; do
./run.sh +set net_port 27733 +exec server.cfg
done;
screen -dmS etqw ./start.sh
Jaybird
08-22-2007, 01:31 PM
There is a really, really nice script bundled with Jaymod that is easily adapted to QW (I got it working in about 2 minutes). It is built in such a way that it allows you to run multiple servers off of one base installation, and does not rely on screen nor pidof nonsense.
Deemer1
08-22-2007, 03:34 PM
There is a really, really nice script bundled with Jaymod that is easily adapted to QW (I got it working in about 2 minutes). It is built in such a way that it allows you to run multiple servers off of one base installation, and does not rely on screen nor pidof nonsense.
Care to share that with anyone?
Jaybird
08-22-2007, 04:00 PM
It's available to everyone, just download the mod from the site. It's packaged, and requires minor modification.
Mxyzptlk
08-26-2007, 01:22 PM
If you need help starting a Linux server, here's a copy of our script which we're using for a couple of ETQW servers. The script is derived from what we bundle with Jaymod. It creates 2 processes when ETQW is launched - the looper which restarts etqwded.x86 if it dies, and etqwded.x86 server itself.
1. read the comments, and set the QW_* values according to your own needs.
2. create your own base/server.cfg
usage: ./serverctl { start | stop | status | restart }
http://www.clanfu.org/etqw/serverctl
escapedturkey
08-28-2007, 11:58 AM
Continuous looping scripts are not a great idea. They stay in memory and eat resources. It's much better to use a crontab and have the script exit after each cycle.
:cool:
Mxyzptlk
08-28-2007, 12:17 PM
Continuous looping scripts are not a great idea. They stay in memory and eat resources. It's much better to use a crontab and have the script exit after each cycle.
:cool:
Have to disagree. 540KB is typical resource usage on the looper script which is minimal. And the looper script can guarantee that it will not re-start the server until the old one dies and a short grace period of idle time passes. With crontab set at every 10 minutes it means it can take as much as 10+ minutes to come back online, far too much time IMHO. Setting crontab at higher frequencies and you end up getting even more in-efficient, especially considering the possibility of running 4 or 8 servers on the same host; re-running the same script over and over again. If admins for an 8-server host want no more than 15 or 30 second delay before launching a new server via crontab, then on avg. that's running your script every 1.875 or 3.75 seconds, respectively. Ouch.
...would be nice to move this topic to the server admin forum.
Nappy
08-29-2007, 02:57 AM
I've always used this (http://tjw.org/etded/) to run ET as a service. Modifying it for ETQW should be trivial.
Jaybird
08-29-2007, 01:15 PM
The problem with tjw's scripts are that they rely on a program that differs greatly between unix versions, pidof. If pidof doesn't work as tjw expects it, the script will fail miserably. Also, it keeps you from running multiple servers under one account.
spirit
08-29-2007, 01:32 PM
Why is this thread in the mapping forum?
Kamikazee
08-29-2007, 01:56 PM
Why is this thread in the mapping forum?
People started threads over here before the server admin section had taken shape.