![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| AIX Crashed.. | pbsrinivas | AIX | 3 | 07-12-2007 06:23 PM |
| old server crashed | billfaith | UNIX for Dummies Questions & Answers | 5 | 02-01-2007 06:23 AM |
| Gollum got crashed | tayyabq8 | Post Here to Contact Site Administrators and Moderators | 0 | 10-22-2006 05:00 AM |
| kill crashed out users | tez | Shell Programming and Scripting | 2 | 08-25-2006 07:59 AM |
| Genome Startmenu crashed why I don't Know ?? | atiato | UNIX Desktop for Dummies Questions & Answers | 1 | 02-26-2002 08:37 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Restarting a Crashed Process
Hello,
I host a couple of Call of Duty gameing servers. There are some hackers who love the crash them. When they crash them it simply causes a segmentaion fault and kills the PID. I was wondering it you could help me write a script to simply restart the program after it has been crashed. The program works as follows: If you want to start a server you simply type: "./cod_lnxded +exec p31.cfg &" It then creates a backgrounded PID. I have created a script to launch about 10 of these. Now all I want is a script to see if any of these crases and to restart them. Thanks a million, Robert |
|
||||
|
#!/bin/bash
./cod_lnxded +exec sam.cfg & ./cod_lnxded +exec h20war.cfg & ./cod_lnxded +exec cypher.cfg & ./cod_lnxded +exec ryan.cfg & ./cod_lnxded +exec cell.cfg & ./cod_lnxded +exec alls.cfg & ./cod_lnxded +exec p31.cfg & exit 0 |
|
|||||
|
Why did you choose to exit your script? I probably would try something like this:
For each process Check to see if a process is running based upon your script name if no process is found Submit the process in the background Create a lock file containing the PID value Determine an appropriate wait interval then poll each process based on the value contained in the lock file. If the process is no longer running, restart it, otherwise check the next process. Run the script from a crontab but make sure you only have 1 instance running at a time (again use a lock file for the main script). Last edited by google; 05-02-2005 at 09:24 PM.. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|