[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:

cd /home/dc/bf1942
#ulimit -c unlimited
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 
                 /bin/rm /home/dc/newsettings/copy

         ./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`
         if test $failcount -gt 5 ; then
                 exit 1
         sleep 3

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,


More information about the Bf1942 mailing list