Solved

Perl monitor

Posted on 2004-08-27
5
275 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
Comment Utility
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
Comment Utility
yeah umm...I don't know perl that good :(
0
 
LVL 6

Expert Comment

by:holli
Comment Utility
linux or windows?
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now