User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 456,447 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,666 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Shell Scripting advertiser: Programming Forums
Views: 1116 | Replies: 1
Reply
Join Date: Nov 2007
Posts: 2
Reputation: psmawson is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
psmawson psmawson is offline Offline
Newbie Poster

Question Starting, Stopping, Updating Shell Script

  #1  
Nov 22nd, 2007
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

#!/bin/sh

cd /games/st0n3r/css_dust2/

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

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

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

esac
exit 0
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Nov 2007
Location: Frederick, MD
Posts: 4
Reputation: t_rectenwald is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 2
t_rectenwald's Avatar
t_rectenwald t_rectenwald is offline Offline
Newbie Poster

Re: Starting, Stopping, Updating Shell Script

  #2  
Dec 2nd, 2007
Hello,

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:

update)
    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/
    else
        echo "Unable to locate the steam binary; cannot update"
        exit 1
    fi
;;

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.

Regards,
Tom
Last edited by t_rectenwald : Dec 2nd, 2007 at 6:32 pm.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Shell Scripting Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Shell Scripting Forum

All times are GMT -4. The time now is 1:52 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC