Hi Guys,

I managed to patch together some code but now im a little stuck with getting through the rest of it, i want be able to use a script to start, stop, restart and update a cs server, under niether is what i have so far, to update the server i would normal have to locate the server directory and use the command "./steam -command update -game "Counter-Strike Source" -verify_all -dir /games/st0n3r/css_dust2/". any help would be great


cd /games/st0n3r/css_dust2/

case "$1" in
sudo screen -d -S cs ./srcds_run -game cstrike -port 30015 +ip +maxplayers 33 +map de_dust2 +tv_port 30016 -autoupdate

screen -r css_dust2 -X quit
echo Server Has Been Stopped!

echo "Usage: hlds {start|stop}"
exit 1

exit 0


If I understand correctly, you want to add an update section to your case statement but the location of the 'steam' binary varies per server. If that is the case, you can try something like this:

    steam_cmd=$(find / -name steam 2> /dev/null)
    if [ "$steam_cmd" ]; then
        $steam_cmd -command update -game "Counter-Strike Source" -verify_all -dir /games/st0n3r/css_dust2/
        echo "Unable to locate the steam binary; cannot update"
        exit 1

One recommendation... if you have a better idea of the whereabouts the binary, replace the "/" in the find command with something more accurate, perhaps "/games," otherwise the script will search the entire server for that binary and take some time.