Quake3World.com Forums
     Quake III Arena/Quake Live Discussion
        Linux bash script for managing quake live servers


Post new topicReply to topic
Login | Profile | | FAQ | Search | IRC





Previous topic | Next topic 
Topic Starter Topic: Linux bash script for managing quake live servers

One Man Army
One Man Army
Joined: 23 Dec 1999
Posts: 10568
PostPosted: 04-11-2017 11:47 AM           Profile Send private message  E-mail  Edit post Reply with quote


I wrote a small bash script last year so i could easily change game types and stuff. I'll post it here, maybe it will come in handy for somebody.

You basically make a config and mappool for each gametype and stick it in baseq3. (configs should be called ctf_server.cfg, mappool_ctf.txt for example.) Replace the baseq3 in the script with the path of your baseq3. It swaps out the server configs for you and kills the qz process. You should use something like supervisord which will restart the qzeroded process automatically if it isn't running. http://supervisord.org/

[root@doomer ~]# ./ql.sh
Usage: ql [gametype(duel/ctf/ca/rr/ft/ad)] [private(0/1)]

So to respawn the server as a private duel server: ./ql.sh duel 1

Code:
#!/bin/bash

baseq3="/home/user/quakelive/baseq3"
gametype=(duel ctf ca rr ft ad)

if [ -z "$1" ];then
   echo "Usage: ql [gametype(duel/ctf/ca/rr/ft/ad)] [private(0/1)]"
   exit 1
fi

if [[ ${gametype[*]} =~ "$1" ]];then
   cp $baseq3/mappool_$1.txt $baseq3/mappool.txt
   cp $baseq3/base_server.cfg $baseq3/server.cfg
   sed -i "1s/^/exec $1_server.cfg /" $baseq3/server.cfg
   for i in `ps aux |grep qz |awk '{ print $2 }'`; do kill -9 $i; done 2>/dev/null

echo "Setting gametype to $1 "

else
   echo "Scuse me? $1? Supported gametypes are ${gametype[*]}"
   exit 1
fi

if [ "$2" == "1"  ];then
        sed -i 's/set sv_master "1"/set sv_master "0"/g' $baseq3/server.cfg
        echo "Private Server"
   exit 1
else
   echo "Public Server"
   exit 1
fi


Don't contact me for troubleshooting.




Top
                 
Quake3World.com | Forum Index | Quake III Arena/Quake Live Discussion


Post new topic Reply to topic


cron
Quake3World.com
© ZeniMax. Zenimax, QUAKE III ARENA, Id Software and associated trademarks are trademarks of the ZeniMax group of companies. All rights reserved.
This is an unofficial fan website without any affiliation with or endorsement by ZeniMax.
All views and opinions expressed are those of the author.