[bf1942] Using 'screen' successfully

James Gurney james at globalmegacorp.org
Thu Nov 11 12:17:18 EST 2004


On 11/11/2004 9:02 AM, Troy Chinnery wrote:
> How can I make screen wait for it to restart? Is there a better way?

It works for me, probably because I wrap everything up in a script, so 
the script is always running, even if the server has restarted.

For reference, I launch the script like this:

screen -a -m -d -S dc ./rundc

The 'rundc' script looks like this:

#!/bin/bash
cd /home/dc/bf1942
#ulimit -c unlimited
failcount=0
while : ; do
         start=`date '+%d%H%M%S'`
         echo "bf started at $start" >>bf.log
         if [ -a /home/dc/newsettings/copy ]; then
                 /bin/cp /home/dc/newsettings/*.con 
/home/dc/bf1942/mods/bf1942/settings/
                 /bin/rm /home/dc/newsettings/copy
         fi

         ./bf1942_lnxded +statusMonitor 1
         date >>crash.log
         stop=`date '+%d%H%M%S'`
         t=`expr $stop - $start`
         if test 0 -le $t -a $t -lt 20 ; then
                 failcount=`expr $failcount + 1`
         else
                 failcount=0
         fi
         if test $failcount -gt 5 ; then
                 exit 1
         fi
         sleep 3
done
# EOF

This script includes a system to copy over new config files 
automatically, since you can't edit the config files in the settings 
folder while the server is running. I have a folder called 
'newsettings'. If I want to make changes to the config, I edit the 
serversettings.con or maplist.con in this folder, then 'touch copy' in 
there, then restart the server. The script then handles putting the new 
config files in place. This works great here.

Hope this helps,

James



More information about the Bf1942 mailing list