[cod] Linux Startup scripts?

Nathan Peters natedog550 at hotmail.com
Mon Dec 15 13:36:35 EST 2003


Sweet dude!  That's what I was gonna try and figure out.  How to search and see if the server is running!  Thanx man!  You rock!  Your start script has some similarity with mine.  I'll post mine like I said when I go to lunch.  That's what happens with stuff like this.  Theres always tons of different ways of getting to the same objective.  Mine actually looks very similar to a regular init script.  Has start, stop, and restart all in the same file.  It looks very similar to another init script that someone posted using the screen command but like I said my host doesn't have that working.  Again, thanks Starkness!

Nathan - A.K.A. [BASHYOU] SNiPeS
  ----- Original Message ----- 
  From: www clan - Starkness 
  To: cod at icculus.org 
  Sent: Monday, December 15, 2003 12:21 PM
  Subject: RE: [cod] Linux Startup scripts?


  Here is a cronjob I use for sof2.  I was working on making it work for cod, but got too busy and can't get the time to work on it.  I hope this can help.  If it works for you, please post back here if you makde any changes.

  Thanks!

  //Starkness

  //Cronjob

  */5 * * * * /home/games/sof2/check_sof2_server.sh

  //End cronjob


  This runs a check script which will run a start script if it doesn't find the server running.

  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ///Begin Check script///

  #!/bin/sh

  SERVER=`ps -ef | grep -v grep | grep -c sof2ded`

  if [ "$SERVER" != "0" ] ; then
        echo "Already Running, exiting"
        exit
  else
        echo "Starting up the server..."
        cd /home/getawebhost/sof2
        /home/getawebhost/sof2/start.sh > /dev/null 2>&1
  fi

  ///End Check script///

  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ///Begin Start script///

  #!/bin/sh
  cd /home/games/sof2
  ./sof2ded +set dedicated 2 +set sv_pure 1 +set sv_punkbuster 1 +set fs_homepath /home/games/sof2 +set net_ip xx.xx.xx.xx +set net_port 20100 +exec sof2.cfg +exec +set fs_game osp > /dev/null &

  ///End Start script///
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


    -----Original Message-----
    From: Nathan Peters [mailto:natedog550 at hotmail.com]
    Sent: Monday, December 15, 2003 1:07 PM
    To: cod at icculus.org
    Subject: Re: [cod] Linux Startup scripts?


    Cool.  Yeah what I'm planning to do as far as the server not responding is probably a cron job that runs every 5 minutes or so.  If it finds that the server process is not running it will run my start script.  If it finds it is running it will not do anything.  Something to that nature.  Man the possiblities of a perfect set of scripts we could all create if we all put our ideas together!

    Nathan - A.K.A. [BASHYOU] SNiPeS
      ----- Original Message ----- 
      From: MikeyDee 
      To: cod at icculus.org 
      Sent: Monday, December 15, 2003 11:46 AM
      Subject: Re: [cod] Linux Startup scripts?


      here is my startup config that works  just fine.  If i find the server not responding I just login and kill -9 the pid
      #!/bin/bash
      while true
      do
      /home/user/callofduty/cod_lnxded +exec ded.cfg +sets gamestartup \"`date +"%m-%d-%Y %T"`\"
      echo "server crashed on `date`" > last_crash.txt
      done
        ----- Original Message ----- 
        From: Nathan Peters 
        To: cod at icculus.org 
        Sent: Monday, December 15, 2003 9:11 AM
        Subject: Re: [cod] Linux Startup scripts?


        Not sure if I can help you there man.  I don't know a ton about linux.  Yet there is a bunch of peeps here that do.  I will tell you in advance what they will need.  Do a top command or something that shows all the processes running.  Too many variables can contribute to stuff like that - hanging, crashing, etc.  More details you can give them the better.  What my script does is run the program in the background and gives it the nohup command and also writes to a logfile.  This keeps the process from quittin'.  It works very well.  I'm very proud of myself haha.  Many hours of research and search engines finding the pieces I needed to make it work.  As far as the screen command goes I don't know enough about that to help you.  But from what I have learned it keeps it running when you close the shell or logoff the system.  Anyone can correct me if I'm wrong.  Anyways, that's my input.

        Nathan - A.K.A - [BASHYOU] SNiPeS
          ----- Original Message ----- 
          From: MikeyDee 
          To: cod at icculus.org 
          Sent: Monday, December 15, 2003 10:57 AM
          Subject: Re: [cod] Linux Startup scripts?


          That sounds wonderful.  I have been running the server and never had crash yet it just hangs with either 100% cpu and none can connect.  That  is what I am trying to sort out getting restarted?

          Red Hat 8.0 install on the OS.  I have not tried the latest screen commands does that change the way the dedicated server runs?
            ----- Original Message ----- 
            From: Nathan Peters 
            To: cod at icculus.org 
            Sent: Monday, December 15, 2003 6:58 AM
            Subject: Re: [cod] Linux Startup scripts?


            Hey everyone.  It took me 5 hours this weekend to write custom startup, restart, and shutdown scripts for the medal of honor linux server - because the server I'm hosted on doesn't have the screen command and I didn't want to have to install a ton of stuff to make it work.  I'm also in the process of writing scripts to turn mods on and off very easily and also a script that emails me when the server goes down or a script that restarts the server, not sure yet.  But, I'm pretty sure these scripts will work for CoD also.  I copywrited or licensed them whatever you want to call it with the GNU license so they're free but I still get credit for writing them, so if you want to take a look at them let me know and I'll put them somewhere where you can download them, that way you get a copy of the license.  Reason: It took me a long time to do this and I doubt anyone has scripts like these.  They can be run from a cron also.

            Peace out,
              Nathan - A.K.A. [BASHYOU] SNiPeS
              ----- Original Message ----- 
              From: David A. Fuess 
              To: cod at icculus.org 
              Sent: Monday, December 15, 2003 7:32 AM
              Subject: RE: [cod] Linux Startup scripts?


              I have mine in a forever loop with a 5 second delay. If it crashes, which is rare, it the quit command is issued then it pauses for 5 seconds and restarts the server. The script also manages the log files and other cleanup tasks.

              At 10:13 AM 12/13/2003 -0800, you wrote:


                Okay thanks for all the feedback.

                 

                Next question is I used to have to set a cron job or something to restart the server when it hangs or crashes.

                 

                Anyone using any daemon tools or supervisor tools on CoD that work.       

                 

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

                From: Rene de Vries [mailto:rene.devries at home.nl] 
                Sent: Thursday, December 11, 2003 11:21 PM
                To: cod at icculus.org
                Subject: RE: [cod] Linux Startup scripts?

                 

                Hi,

                 

                create a file

                ex: vi start

                paste this "screen -A -m -d -S cod /cod_lnxded +map_rotate"

                write and quit vi

                chmod +777 start

                execute: /start

                ctrl a+d to leave the screen

                 



                  -----Oorspronkelijk bericht-----

                  Van: MikeyDee [mailto:mikeydee at usd.wli.net]

                  Verzonden: vrijdag 12 december 2003 0:43

                  Aan: cod at icculus.org

                  Onderwerp: [cod] Linux Startup scripts?


                  anyone have linux startup script ?




                    
                  beside doing /cod_lnxded




                    
                  I was trying to add +set commands to get it automated but seem to fail on me?



                   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://icculus.org/pipermail/cod/attachments/20031215/af90bb3d/attachment.htm>


More information about the Cod mailing list