Solved

Perl monitor

Posted on 2004-08-27
5
278 Views
Last Modified: 2011-09-20
Could someone write me a perl script that would make sure my application is running, and if it quits, make it start again. Right now to start my application I use the following command: "screen ./gameserver +ip 192.168.1.1". I need a perl script to make sure it keeps running. And no, I can't edit the application (gameserver) to make it do something special.

Thanks.
0
Comment
Question by:e1337coderz
5 Comments
 
LVL 11

Accepted Solution

by:
avizit earned 110 total points
ID: 11919317
why dont you try it yourself ? heres the basic idea

1.  put the output of  ps -aux | grep gameserver  into a variable.
 
ps -aux will list the running programd and grep will extract the line gameserver

so if gameserver is not running then the ouput will be empty

so you can have something like  

$output = `ps -aux | grep gameserver`;

2> next check if this line is empty  and if so run the command again by

`screen ./gameserver +ip 192.168.1.1`;


...........
there might be simpler solutions though


0
 

Author Comment

by:e1337coderz
ID: 11919548
yeah umm...I don't know perl that good :(
0
 
LVL 6

Expert Comment

by:holli
ID: 12018091
linux or windows?
0

Featured Post

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

822 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question