| 
				 Re: Linux Admining 
 OK all of you Linux people. Have fun with THIS one. This is my bl_game.sh for creating small blitz games. Code: 
 #!/bin/bash
 
 OP1=`echo $RANDOM % 79|bc`
 OP2=`echo $RANDOM % 79|bc`
 OP3=`echo $RANDOM % 79|bc`
 for OP in $OP1 $OP2 $OP3
 do
 if [ $OP -eq 25 ]
 then $OP=0
 fi
 done
 
 PORT=7777
 PTtest=1
 until [ $PTtest -eq 0 ]; do
 PORT=`echo $RANDOM % 1000 + 8000|bc`
 PTtest=`netstat -an|grep -c :$PORT`
 done
 
 MPASS=`makepasswd`
 WURDnum=`echo $RANDOM$RANDOM % 118614 |bc`
 WURD=`egrep "^....$|^.....$|^......$|^.......$|^........$|^....  .....$" \
 /usr/share/dict/words|head -$WURDnum|tail -1`
 GAME=bl_$WURD
 MAP=eye.map
 DIR=~/dominions3/savedgames/$GAME
 ERA=$1
 if [ -z "$1" ]
 then
 ERA=`echo $RANDOM % 3 + 1 |bc`
 fi
 
 DESC=" era $ERA game $GAME on port $PORT "
 echo $DESC
 #with $OP1 $OP2 $OP3
 # --normai $OP1 --normai $OP2 --normai $OP3 \
 
 dom3 -T --makemap $GAME --mapaa --mapsize 640 480 --mapprov 30
 MAP=$GAME.map
 echo $DESC
 mkdir $DIR
 
 nohup dom3  -g $GAME --port $PORT -ST --statfile --scoredump \
 --preexec $DIR/pre.sh  --postexec $DIR/post.sh \
 --era $ERA --indepstr 6 --hofsize 15 --magicsites 65 \
 --renaming --mapfile $MAP --masterpass $MPASS \
 -q --hours 24 >$DIR/game.log 2>$DIR/game.err &
 
 echo $DESC >>BLITZ_games.txt
 
 PID=`ps a | grep $GAME | grep dom3 | cut -d" " -f2`
 echo "kill -9 "$PID >$DIR/kill.sh
 echo $MPASS >$DIR/master.txt
 ls -blart /tmp/dominion* |tail -1 >$DIR/tmp.sh
 echo " " >$DIR/pre.sh
 echo " " >$DIR/post.sh
 
 chmod +x $DIR/*.sh
 
 # to stop the game immeadaitely after start
 # unremark the next line
 #cp $DIR/kill.sh $DIR/post.sh
 
 echo "mv ~/dominions3/maps/$GAME.* $DIR/" >$DIR/pre.sh
 echo "cp /dev/null $DIR/pre.sh" >>$DIR/pre.sh
 
 echo "cp $DIR/game.log $DIR/~game.log" >$DIR/post.sh
 echo "cp /dev/null $DIR/game.log" >>$DIR/post.sh
 
 
				__________________-- 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!)
 |