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: 10547
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


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

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 "

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

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

Don't contact me for troubleshooting.

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

Post new topic Reply to topic

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group