[mohaa] linux auto reboot script

3esiek 3esiek at wp.pl
Thu Oct 9 08:19:52 EDT 2003


Hello Terrain,

Wednesday, October 8, 2003, 9:55:58 AM, you wrote:

TD> Is there such a script, I assume there must be, and where can I get it?

i have somethings like that - as a conslusion to what's been said in
this mailing list

to run the server...

1. script to be run in screen env
[root at fpp rc.pitt]# cat moh_ded_TDM-while   {chmod 644}
---------------------------------------------------------
#!/bin/bash
while true
do
./mohaa_lnxded +set logfile 3 +set logfilename mohaa-TDM.log +set
net_port 12203 +exec server_TDM.cfg
echo "Server Mohaa-TDM wylozyl sie dnia `date +%F' '%R`" >>
../server_crash.txt
done
--EOF


2. script running this screen env, executing previuos one
[root at fpp rc.pitt]# cat moh_ded_TDM    {chmod 744}
---------------------------------------------------------
#!/bin/bash
screen -S mohTDM -m -d sh moh_ded_TDM-while
--EOF


3. script shutting down the server proces & screen -
should be executed like that :

./shutdown mohTDM

---------------------------------------------------------
[root at fpp rc.pitt]# cat shutdown
#!/bin/bash
# uwalamy server gry wskazanej 1-wszym parametrem
if [ "$1" != "" ]; then
    KILL_PID=`/bin/ps ax | grep SCREEN | grep "$1" | cut -c1-10 | tr -d [:punct:] | tr -d [:blank:]`
#    echo $KILL_PID
    kill $KILL_PID
    screen -wipe 2>&1 /dev/null
fi

----------
scripts can be succesfully used in cron routines to manage time-scheduled on/off

-- 
Best regards,
 3esiek                            mailto:3esiek at wp.pl




More information about the Mohaa mailing list