[conquest] AWK script

madams at phantomware.ca madams at phantomware.ca
Sun Jun 21 10:18:53 MDT 2009


I guess it would help if I actaully included the file...

===File ~/bin/scripts/conquest-metaserver-monitor===========
#!/usr/bin/awk -f
# 
# Queries a Conquest metaserver for games with active players
# See http://conquest.radscan.com/conquest.html for more info
#
# Fields
# =====================================================================
#  ?  SERVER_HOST  PORT  NAME  VERSION  MOTD  MAX_SLOTS  ACTIVE#  VACANT#  ROBOT#  ?  ?  CONTACT_EMAIL  LOCALTIME
#  1  2            3     4     5        6     7          8        9        10      11 12 13             14
#

BEGIN {
    FS="|"
    NetService = "/inet/tcp/0/conquest.radscan.com/1700"
    print "name" |& NetService
    while ((NetService |& getline) > 0) {
        if ($8 > 0) {
            printf "echo \"Conquest server has %d/%d ACTIVE players (%d VACANT, %d ROBOT)\nconquestgl -f -s %s:%d\n\n\" | mail -s \"ACTIVE CONQUEST GAME\" matt,tamarella", $8, $7, $9, $10, $2, $3 | "/bin/sh"
            close("/bin/sh")
        }
    }
    close(NetService)
}
============================================================



More information about the Conquest mailing list