View Full Version : Keep alive script for linux ded?
imported_jjbean
11-07-2003, 08:09 PM
Hi everyone, i just god cod up and running on my linux box.
But. . .
If i ssh in and run the server, the *ttyconsole* or whatever it is comes up, the server runs fine during this. . . BUT! if i shut off putty (the prog i use to ssh and connect into my linux box) my server shuts off.
so i just wondered if there is a way of keeping it running even when i exit the console. I had this prob in moh once and i cannot remember how i fixed it.
and i have tried that disable ttyconsole command, but not quite sure where im supposed to put it or if it would do any good.
any help would be great!
greensha
11-07-2003, 08:21 PM
Here is my simple keep alive script.
#!/bin/sh
while true; do
./cod_lnxded +set dedicated 2 +set net_ip 66.36.250.17 +exec servercfg.cfg
sleep 30;
done
or you can use the & at the end of your command line which wiil background the process.
HankScorpio
11-08-2003, 03:55 AM
There are several ways of doing what you need. The easiest, as greensha suggested, is to just background the process when you execute it by appending the & to the end of the line. This will allow you to logout and leave the server running.
The script which greensha posted would merely restart the server if it crashes or if you do \rcon quit. You'd still need to append the & to the end of the script name when you run it in order to be able to log out without losing the server.
What I suggest is that you look into using the screen program. It may already be installed on your system. Using screen allows you to reconnect to the console of the server even if you've logged off and back on.
To use it, just create a shell script such as this...
#!/bin/sh
screen -L -dm -S cod ./cod_lnxded +set dedicated 2 +set net_ip 66.36.250.17 +exec servercfg.cfg
You won't need to append & because it'll already background itself. To connect to the console of your server just type screen -r cod. When you're connected to the console, hit CTRL-a and then hit d to return back to a shell prompt so you can log out. That's about the jist of it, if you need more info just look at the man page for screen.
imported_jjbean
11-08-2003, 01:12 PM
thanks guys! I Got it but not in the methods you suggested. . . (besides the & thing)
I forgot to mention i am using FREE BSD so anyway this was the script i used
echo "" &
./cod_lnxded +exec autoexec_mp.cfg > /dev/null 2>&1 &
echo "cod-server started." &
imported_antstrength
11-14-2003, 05:21 PM
Hi everyone, i just god cod up and running on my linux box.
.
.
.
any help would be great!
Jjbean,
Could you please send me an email at dave@energybytes.com
Dave
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.