Server scripts

The place to discuss your client and server issues, or to post your client and server related problems. Now with added Anticheat flavour.

Moderator: Moderators

Post Reply
Haudrauf
tripped on its own grenade
Posts: 331
Joined: Tue Aug 26, 2003 11:20 am
Location: de
Contact:

Server scripts

Post by Haudrauf »

So I wanted to release a nice shell-script that I built years ago...
Perhaps somebody has a use to it.
And perhaps some other people have nice server-scripts too.. so, come on and release them to help other serveradmins.

Here's my automatic r1q2ded-updater which I start nightly.
It is located in "/home/gameservers/quake2/updater" while the gameserver is located in "/home/gameservers/quake2" as you can imagine. :)

Code: Select all

#!/bin/sh

cd /home/gameservers/quake2/updater

# cvs, binary
mode=cvs


# if cvs ... 1, 0
anticheat=1

# if binary ... old, new, x64
binarystyle=new


if [ "$mode" == "binary" ]; then
        ./r1q2updater --quiet --debug > output.txt

        UPDATED=`cat output.txt | grep -i VALID`

        if [ "$UPDATED" != "" ]; then
                echo "It has been updated!"

                cp r1q2ded ../ -f
                cp r1q2ded-old ../ -f

                chmod ug+x ../r1q2ded

                # put your rcon command to restart the server here.

        fi

elif [ "$mode" == "cvs" ]; then

        CVSROOT=:pserver:anonymous:@akka.r1hosting.com:/home/r1q2

        cvs -d $CVSROOT login
        cvs -d $CVSROOT checkout r1q2

        cd r1q2/binaries/r1q2ded

        # if we want anticheat in the compile
        if [ "$anticheat" == "1" ]; then
                cat Makefile | sed -e 's/=-DDEDICATED_ONLY/=-DANTICHEAT -DDEDICATED_ONLY/g' | sed -e 's/unzip.c$/unzip.c sv_anticheat.c/g' > Makefile.ac

                cp Makefile.ac Makefile
                rm Makefile.ac
        fi

        cd ..

        make clean
        make r1q2ded

        cp r1q2ded/r1q2ded ../../../ -f

        echo now restart server with rcon or somehow else.
        # always restart server .. we can't really find out if it is updated.. yet.
fi
my crontab says:

Code: Select all

MAILTO="your@serveradminmailaddress.com"
07 5 * * *     /home/gameservers/quake2/updater/r1q2update.sh
Have fun, and don't ask too many questions about it. Post other scripts instead! :)
ImageOwner of http://aq2maps.quadaver.org
Not part of #aq2admins for a reason.
Post Reply