•
•
•
•
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 455,973 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 3,828 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: 1114 | Replies: 1
![]() |
•
•
Join Date: Nov 2007
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
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
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 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:
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
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.
![]() |
•
•
•
•
•
•
•
•
DaniWeb Shell Scripting Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- Sending email from a shell script (Shell Scripting)
- Problem with variables in Windows shell script (Windows NT / 2000 / XP / 2003)
- Using find in a bash shell script (Shell Scripting)
- Shell Script for Gnome 2.6 Print Manager. (Shell Scripting)
- How to su properly in a shell script (Shell Scripting)
Other Threads in the Shell Scripting Forum
- Previous Thread: i need help!
- Next Thread: Need Help! Could someone please check the two tiny bash scripts to see if they work?


Linear Mode