[cod] startup script
Michael Roark
rhuian at sbcglobal.net
Thu May 20 15:37:36 EDT 2004
I didn't write these but they work great for me.
First the startup script itself:
#!/bin/sh
screen -d -m -S cod1 ./mohcod_run +set fs_homepath ./ +set fs_basepath ./ +set fs_game pam +set comzoneMegs 32 +set vm_game 0 +set ttycon 0 +exec codserver.cfg +map mp_stalingrad
Now the script that calls that script:
#!/bin/sh
# Change into correct directory before starting
echo 'Switching to /place/where/cod/is/installed directory...'
cd /place/where/cod/is/installed
# If the server was currently running shut it down first
./cod_shutdown
echo 'Pausing 5 seconds..'
# Delay while server shutting down
sleep 5
echo 'Starting up CoD server..'
# Startup the server
./mohcod.sh
And now the shutdown script:
#!/bin/sh
# Shutdown the screen process named cod
echo 'Shutting down CoD server..'
screen -r cod1 -X quit
Troy Chinnery <t_chinnery at iprimus.com.au> wrote:
I nicked this from the [mohaa] list a while back, I think. I've adapted it to
run all my servers on linux, not just game servers too. (code quoted for effect).
cod_load.sh:
> #!/bin/bash
>
> echo cod_load.sh: Load Call of Duty With Screen
>
> cd /home/coduser/.callofduty
>
> echo cod_load.sh: Screen Call of Duty Detached Console
>
> screen -S cod -m -d ./cod.sh
>
> echo cod_load.sh: Finished Screen Command
You could put that executable in /usr/bin or just in /home/coduser (Don't
forget to set the executable bit (chmod ugo+x cod_load.sh)
cod.sh:
> #!/bin/bash
>
> echo cod.sh: Launching Call of Duty
>
> cd /usr/local/games/callofduty
>
> echo cod.sh: Loop Initialize
> while true
> do
> echo cod.sh: Loop Start
> echo cod.sh: To Exit Loop Hit CTRL-C While Sleeping
> sleep 5
> echo cod.sh: Server Start
> ./cod_lnxded +set dedicated 1 +set com_hunkMegs 128 +set com_zoneMegs 32 +exec serverexec.cfg
> echo cod.sh: Server Exit
> echo cod.sh: To Exit Loop Hit CTRL-C While Sleeping
> echo cod.sh: Sleep 15 Seconds
> sleep 15
> echo cod.sh: Loop Restart
> done
Set dedicated to 2 for an Internet server of course. Pretty elegant solution
to auto restarting the server as well.
Can type 'screen -r cod' to get to the CoD console, and hit ctrl+a,d to detach
it again. I've seen far more complex ones do pretty much the same thing. But
for more features, like log archiving etc etc you would need something a
little more complex at least.
--
Nevyn.
James Casey - DigitalNetwork Limited wrote:
> Hi All
>
> Finally got my cod server running, running version 1.4.
>
> I start the server manually through ssh and whenever i log off ssh it closes
> the server so i want it to run as a service but my linux knowledge is pretty
> limited does any one havea script for doing thisor can point me in the right
> direction.
>
> Many thanks
>
> James
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://icculus.org/pipermail/cod/attachments/20040520/7fc96e1b/attachment.htm>
More information about the Cod
mailing list