Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Perl monitor

Posted on 2004-08-27
5
281 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
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…

829 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