IPB

Welcome Guest ( Log In | Register )




 
Reply to this topicStart new topic
> Respawning Processes, Shell magic
znx
post Aug 21 2005, 12:18 AM
Post #1


Linux-Noob GURU
********

Group: Members
Posts: 1220
Joined: 21-March 05
From: Aberdeen, Scotland
Member No.: 798



He's a quick tip to force a process to always keep respawning. Basically if the process dies, another will start in its place.

Save this as, respawn.sh:
CODE
#!/bin/sh
while [ 1 ]; do
   /bin/ls -l /home/znx
done


Now execute it like this:
CODE
$ ./respawn.sh


Now the screen will fill with lots and lots of ls information. Ctrl+C will kill it for you. This is an example of a neverending loop. Now where would you want this? Well the reason that I'm writing this is that I recently helped Blue|Moon setup this to ensure that a Counter Strike Source server would keep running:
CODE
#!/bin/sh
while [ 1 ]; do
   cd /path/to/install
   ./srcds_run -game cstrike ..... the rest of your options ......
done


Started with:
CODE
$ cd /path/to/install
$ screen -m -d -S sourceserver ./respawn.sh


Now when the server quits or is killed, another takes its place, saving you the user from having to login remotely and start it all the time smile.gif


--------------------
Bye
Go to the top of the page
 
+Quote Post
bluemoon
post Aug 21 2005, 12:25 AM
Post #2


Noob
*

Group: Members
Posts: 2
Joined: 21-August 05
Member No.: 1080



This script works a treat, theres nothing like this available. znx has spent hours with me tonight creating this and sorting out my system. Great guy, if everyone followed his views in the world smile.gif It would be a hell of a better place

Thanks again
Go to the top of the page
 
+Quote Post
xDamox
post May 15 2006, 04:19 PM
Post #3


t0t5lly l33t linux-noob
******

Group: Moderator
Posts: 390
Joined: 13-December 04
From: Preston, England
Member No.: 655



QUOTE (bluemoon @ Aug 21 2005, 12:25 AM) *
This script works a treat, theres nothing like this available. znx has spent hours with me tonight creating this and sorting out my system. Great guy, if everyone followed his views in the world smile.gif It would be a hell of a better place

Thanks again


hehe yea znx is a cool person always willing to help out smile.gif he knows his stuff too.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 6th January 2009 - 08:43 AM