Solved

Perl monitor

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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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…

739 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