This tutorial is for linux servers as I do not run win32 servers.
To start off this tutorial you'll need to add
to your srcds_run command. this will add the process id into a file. At the moment of writing this, -pidfile did not work correctly so until valve fixes this, you can use this. http://www.machgaming.net/srcds_run.patch.gz which is a patch for srcds_run to use -pidfile
on to the next part, you'll need a crontab, i happen to use vixie-cron. most distros probably come with cron however. If not you can try this, for fedora and debian you can probably..
When crontab is installed simply run "crontab -e" to open the cron editor and add:
This will make cron run srcdchk.sh every 5 minutes. be sure you change "yoursrcdspath" to the path of your srcds_run. You can change the /5 to /1 if you wish. Credit: SirTiger from his full throttle tutorial.
next we'll need the srcdchk.sh
don't forget to
This will also help if the server stops for some reason and does not auto start. There is another way of doing this, which is adding srcdchk.sh to rc scripts. for gentoo its in
Please note that your user that runs this script in cron tab, must be in the group cron.
To start off this tutorial you'll need to add
Code:
-pidfile srcds.pid
on to the next part, you'll need a crontab, i happen to use vixie-cron. most distros probably come with cron however. If not you can try this, for fedora and debian you can probably..
Quote:Fedora: yum vixie-cron
Debian apt-get vixie-cron
FreeBSD: use ports to install vixie-cron(if you don't know how to do this, you shouldn't be using FreeBSD )
Gentoo: emerge vixie-cron
When crontab is installed simply run "crontab -e" to open the cron editor and add:
Code:
*/5 * * * * /home/yoursrcdspath/srcdchk.sh
This will make cron run srcdchk.sh every 5 minutes. be sure you change "yoursrcdspath" to the path of your srcds_run. You can change the /5 to /1 if you wish. Credit: SirTiger from his full throttle tutorial.
next we'll need the srcdchk.sh
Code:
#!/bin/sh
dir="./"
# change this to how you normally run your srcds:
srcdexe="srcds_run -game cstrike -ip 64.182.75.26 -port 27015 +map de_dust +maxplayers 20 -pidfile srcds.pid"
# I wouldn't touch this if I were you.
srcdname="srcds.pid"
########## you probably don't need to change anything below here ##########
cd $dir
if test -r $srcdname; then
# there is a pid file -- is it current?
srcdpid=`cat $srcdname`
if `kill -CHLD $srcdpid >/dev/null 2>&1`; then
# it's still going
# back out quietly
exit 0
fi
echo "Source Dedicated Server Crontab notice:"
echo ""
echo "Stale $srcdname file (erasing it)"
rm -f $srcdname
fi
echo ""
echo "Couldn't find the srcds running. Reloading it..."
echo ""
./$srcdexe
Code:
chmod +x srcdchk.sh
Quote:/etc/init.d/start.localI'm not sure about fedora or debian , its probably something like
Quote:/etc/rc.d/start.localif someone would please clearify this i'll edit the tutorial to fit it.
Please note that your user that runs this script in cron tab, must be in the group cron.
starting 9/24/2006 if your problem has been solved please edit your first post and add [solved] to the begining of the title. Thanks.