Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Perl monitor

Posted on 2004-08-27
5
Medium Priority
?
289 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
[X]
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
5 Comments
 
LVL 11

Accepted Solution

by:
avizit earned 440 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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…
Six Sigma Control Plans

688 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