On Wed, 29 Jun 2011 09:44:29 +0200, Marcel wrote:
Is there a good way to get informed about updates? I have a central
steam installation that gets deployed to all installed servers. So we
don't need to run the steam update on hundreds of servers. But doing
an steam update every five minutes on this "repository" isn't a good
idea I think....

I've done a simple BASH script, using part of Nephyrins nemrun tools, which can be found here: http://www.nephyrin.net/tools/nemrun/1.7/

Download and save srcupdatecheck (Its a Python script, so you need Python on your machine)

Then, save this shell script, edit appropriately (minalertinterval, path to srcupdatecheck, path to steam.inf and action when an update is available), and call with parameter L4D, L4D2 or TF2 (I run it in crontab)

I run a small SMS alerter when theres an update, but you could run sendmail, send an SNMP trap or whatever suits your fancy :)

-- START --
#!/bin/bash
#
# Do not modify these variables, the script uses it to track the last sent alert
# LastSentAlert.L4D:0
# LastSentAlert.L4D2:0
# LastSentAlert.TF2:1309327621
#

# Configuration
# Minimum number of seconds between update notifications, to avoid being spammed when an update is released at 03 in the morning ;)
MINALERTINTERVAL=21600
# Path to Nephyrins srcupdatecheck
SRCUPDATESCRIPT="python /home/srcds/srcdupdatecheck"

# Retrieve gamecode, argument 1
GAMECODE=$1

# Check for gamecode existence
if [ -z "`sed "/^# LastSentAlert\.$GAMECODE/!d" ${0}`" ]
then
        exit 1
fi

# Retrieve last run from script itself, into $BASH_REMATCH array
[[ `sed "/^# LastSentAlert\.$GAMECODE/!d" ${0}` =~ :([0-9]+) ]]
LASTRUN=${BASH_REMATCH[1]}

# Retrieve current time
CURRENTTIMESTAMP=`date +%s`

# Check if lastrun is less than current time minus the alert interval
if [ $LASTRUN -lt $(( CURRENTTIMESTAMP - MINALERTINTERVAL)) ]
then
# Check for update .. Edit all paths to point to the steam.inf file for the respective games
        case $GAMECODE in
L4D) $SRCUPDATESCRIPT <PATH>/l4d/left4dead/steam.inf &>/dev/null;; L4D2) $SRCUPDATESCRIPT <PATH>/left4dead2/left4dead2/steam.inf &>/dev/null;; TF2) $SRCUPDATESCRIPT <PATH>/tf2/orangebox/tf/steam.inf &>/dev/null;;
        esac

        # Check for errorlevel
        UPDATECHECK=$?

        if [ $UPDATECHECK -eq 7 ]
        then
                # There is an update
                # RUN SOMETHING HERE THAT ALERTS YOU

                # Update last sent alert (selfmodifying script)
sed -i -e "s/^# LastSentAlert\.$GAMECODE:.*$/# LastSentAlert\.$GAMECODE:$CURRENTTIMESTAMP/" "$0"
        fi
fi
-- END --

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlds_linux

Reply via email to