Thread: Utility Linux Admining
View Single Post
  #12  
Old September 10th, 2006, 10:04 PM
Gandalf Parker's Avatar

Gandalf Parker Gandalf Parker is offline
Shrapnel Fanatic
 
Join Date: Oct 2003
Location: Vacaville, CA, USA
Posts: 13,736
Thanks: 341
Thanked 479 Times in 326 Posts
Gandalf Parker is on a distinguished road
Default Re: Linux Admining

POST hosting script
-------------------
$GAME="Armageddon"
DIR="/home/dom3/dominions3/savedgames/"$GAME
WEB="/home/dom3/public_html/games/"$GAME

# mark time and system load after host processing
#and make it available for viewing in the games web dir
echo post >>$DIR/system_load.txt
uptime >>$DIR/system_load.txt
echo " " >>$DIR/system_load.txt
cp $DIR/system_load.txt $WEB/system_load.txt

# rotate the score html files
mv $WEB/scores-4.html $WEB/scores-5.html
mv $WEB/scores-3.html $WEB/scores-4.html
mv $WEB/scores-2.html $WEB/scores-3.html
mv $WEB/scores-1.html $WEB/scores-2.html
mv $WEB/scores.html $WEB/scores-1.html
cp $DIR/scores.html $WEB/scores.html
cp $DIR/stats.txt $WEB/stats.txt

# zip up the debug log and then zero the log
zip -9 $DIR/$GAME.zip $DIR/$GAME.log
mv $DIR/$GAME.zip $WEB/$GAME.zip
cp $DIR/$GAME.log "$DIR/OLD"$GAME".log"
cp /dev/null $DIR/$GAME.log

# email notify players that have asked to be told of turns
cat $DIR/notify.txt |/usr/sbin/sendmail gandalf@example.com
cat $DIR/notify.txt |/usr/sbin/sendmail bogus@example.net
__________________
-- DISCLAIMER:
This game is NOT suitable for students, interns, apprentices, or anyone else who is expected to pass tests on a regular basis. Do not think about strategies while operating heavy machinery. Before beginning this game make arrangements for someone to check on you daily. If you find that your game has continued for more than 36 hours straight then you should consult a physician immediately (Do NOT show him the game!)
Reply With Quote