SRCDS Steam group


Looking for a Auto update script for maplist.
#1
Hello there, I'm looking for a basic script that will auto update my map cycle and maplist text files.
If someone has one handy they could hook me up with.
Or I could spend a few minutes building one but rather use someone else's if it's already made. Smile

Just sick of people uploading files and not adding them to my maplists.
Thanks.
Reply
#2
Make a script and add it to the crontab (crontab -e). For a every night replace at 4 AM add:
00 4 * * * /<path>/<script>.scr

Check paths, port, tickrate, servername etc. Script may look something like this (I did not test it!):

#-------------------------------------------------------
PATH=/bin:/usr/bin:/sbin:/usr/sbin
DIR=/<path>/srcds_l
PROC=27015
LOGFILE=/<path>/log.txt
NAME="Counter-Strike Source Public Server"
PARAMETERS="+maxplayers 16 +map de_dust2 +log on +ip <ip> -console -autoupdate -verify_all -tickrate 100 -port 27015"
#-------------------------------------------------------
# To stop the server
#-------------------------------------------------------
if [[ `ps -ef | grep $PROC|grep srcds` ]]
then
echo "Killing $NAME">>$LOGFILE
kill -9 `ps -ef |grep $PROC |awk '{print $2}'`
else
echo "$NAME is OFFLINE">>$LOGFILE
fi
#-------------------------------------------------------
# Updates the mapcycle and maplist
#-------------------------------------------------------
rm /<path>/srcds_l/cstrike/mapcycle.txt
rm /<path>/srcds_l/cstrike/maplist.txt
ls /<path>/srcds_l/cstrike/maps/*.bsp | awk -F "." '{print $1}' >> /<path>/srcds_l/cstrike/mapcycle.txt
ls /<path>/srcds_l/cstrike/maps/*.bsp | awk -F "." '{print $1}' >> /<path>/srcds_l/cstrike/maplist.txt
#-------------------------------------------------------
# Starts the server
#-------------------------------------------------------
if [[ `ps -ef | grep $PROC|grep srcds` ]]
then
echo "Can't start $NAME. Status: online">>$LOGFILE
else
echo "Starting $NAME">>$LOGFILE
if [ -e $DIR ];
then
cd $DIR
./srcds_run $PARAMETERS &
else
echo "$DIR doesn't exist">>$LOGFILE
fi
fi

exit 0
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)