Script to update all SVN server addons (wine servers or Windows with Cygwin)



#!/bin/sh
for file in *
do
        if [[ -d $file ]]
        then
                cd "$file"
                svn up
                cd ..
        fi
done


Someone might find this useful, I use it to update all my gmod SVN addons on my netbsd-powered gmod test server. Drop it into your addons folder and give it execute permission. Then just run it whenever you want to update (can be run from cron each night).

Enjoy.

That’s great except most people use windows.

Or just use http://win-bash.sourceforge.net/

Nice!

I did this, ironically, on python. Was quite a lot more lines than what you have it as bash lines.

Occasionally makes me wonder why I got rid of my working bash implementation of everything related to server maintaining and go try and make a “better” one in python…

Sometimes the simplest solution is the best. I should probably have written a cmd version for windows too based upon that premise, but I can’t remember the syntax as I haven’t used it for years.

I use a load of batch scripts to install/update/delete servers. It really does reduce the time needed to install a server:

  1. Double click on script.

  2. Enter game type.

  3. Enter the IP/Port it’ll run on.

  4. Get a cup of tea (files are now copied from a “cache” of templates so there’s no downloading involved).

  5. Add an entry to FireDaemon to make it a service.

  6. Edit autoexec.cfg to give it a map and maxplayers (this’ll be done through the installer script later too)

  7. Run the service and done!

Whipped up a script for myself too. Thanks for the base. Hopefully at least someone finds this useful :slight_smile:
I don’t know if the line number changes on newer svn versions but if you’re using linux you should be able to fix it yourself :slight_smile:



#!/bin/sh
updatesvn ()
{
                file=$1
                oldrev=`cat "$file/.svn/entries" | head -n 4 | tail -n 1`
                cd "$file"
                svn update -q
                cd ..
                newrev=`cat "$file/.svn/entries" | head -n 4 | tail -n 1`
                if [[ "$oldrev" = "$newrev" ]]
                then
                        echo "No new updates for        \"$file\""

                else
                        echo "Updated \"$file\"         $oldrev->$newrev"
                fi
}

for file in *
do
        if [[ -d $file ]]
        then
                updatesvn "$file" &
        fi
done

echo -e "Updating...

"



Produces this