.com.unity Forums
  The Official e-Store of Shrapnel Games

This Month's Specials

BCT Commander- Save $6.00
World Supremacy- Save $10.00

   







Go Back   .com.unity Forums > Illwinter Game Design > Dominions 3: The Awakening

Reply
 
Thread Tools Display Modes
  #1  
Old September 2nd, 2006, 05:08 PM

Arker Arker is offline
Corporal
 
Join Date: Jun 2006
Posts: 62
Thanks: 0
Thanked 1 Time in 1 Post
Arker is on a distinguished road
Default Re: Linux Admining

Quote:
Gandalf Parker said:
Any commands you can type in to run can be put into a text file. If you make it executable (chmod +x file) then it becomes a script.
It also helps to put the magic numbers in.

#!/bin/sh

should be the very first thing in the file.

And to make sure the permissions are right

chmod 755 file
Reply With Quote
The Following User Says Thank You to Arker For This Useful Post:
  #2  
Old September 2nd, 2006, 06:33 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

The script I did isnt shell specific. Some later ones I do have a shell line since they use special shell variables for things like randoms.

And yeah I guess for public info its probably best to chmod 755 but +x for executable seems easier for people to remember even if it is sloppy.

Of course for public info I probably shouldnt have mentioned telnet since trying to argue down ssh is something only security people would do.

So did everyone follow that script? No questions?
__________________
-- 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
The Following User Says Thank You to Gandalf Parker For This Useful Post:
  #3  
Old September 5th, 2006, 02:39 PM

tibbs tibbs is offline
Sergeant
 
Join Date: Mar 2004
Posts: 304
Thanks: 0
Thanked 0 Times in 0 Posts
tibbs is on a distinguished road
Default Re: Linux Admining

I didn't get a chance to try it yet. I was busy with painting a few rooms in the house. Hopefully early this week.
Reply With Quote
  #4  
Old September 10th, 2006, 08:21 PM
Bluebird's Avatar

Bluebird Bluebird is offline
Second Lieutenant
 
Join Date: Sep 2004
Location: Zürich, Switzerland
Posts: 418
Thanks: 0
Thanked 0 Times in 0 Posts
Bluebird is on a distinguished road
Default Re: Linux Admining

Just as a hint: I am normally hosting games on unix using the 'screen' command. It is a like a 'window manager' for text consoles and has many features (too many to list them here). The nicest one is that you can 'detach' a terminal session which continues running even if you logout, and later 'reattach' to that terminal session on next login.
__________________
There are roads which must not be followed, towns which must not be besieged, positions which must not be contested, commands of the sovereign which must not be obeyed. (Sun Tsu "The Art of War", ca. 500 BC)
Reply With Quote
  #5  
Old September 10th, 2006, 10:00 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

PRE hosting script
------------------

GAME="Armageddon"
DIR="/home/dom3/dominions3/savedgames/"$GAME
WEB="/home/dom3/public_html/games/"$GAME

# make backups
#maybe later I will make it rotating backups
zip -9 $GAME.zip $DIR/*

# blank the log file since it grows by about 5 meg each turn
# this way Im only logging one turn at a time
cp /dev/null $DIR/$GAME.log

# update the viewable copies of the shell files
cp /home/dom3/dominions3/$GAME.sh $WEB/$GAME_sh.txt
cp $DIR/pre_$GAME.sh $WEB/pre_$GAME_sh.txt
cp post_$GAME.sh $WEB/post_$GAME_sh.txt

# mark the time and load at the beginning of hosting
echo pre >>$DIR/system_load.txt
uptime >>$DIR/system_load.txt
__________________
-- 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
  #6  
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
  #7  
Old September 10th, 2006, 10:17 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

the notify.txt that is sent to players
--------------------------------------

Subject: the Armageddon game processed

Your turn is ready at
dom3minions.com

(courtesy of Gandalf Parker at Any1can.net)

----------------------------------------

the notification could also be changed to include the turn number. It could also easily be changed to include emailing the turn file.

Which makes you automatically think PbEM. If a game had its own email address such as armageddon@dom3minons.com then something like procmail could manage incoming emails to place the .2h files (which means "to host") into the game directory. It could also kick off a script to check for all turns being in and then run/quit the host. This would raise the number of games that a server can run by many levels.
__________________
-- 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
Reply

Bookmarks

Tags
admin, automation, command line, hosting, linux, script, server, switches


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 08:06 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2025, Shrapnel Games, Inc. - All Rights Reserved.