Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^3: Linux Process Start Time

by Illuminatus (Curate)
on Jul 27, 2009 at 18:22 UTC ( [id://783628]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Linux Process Start Time
in thread Linux Process Start Time

Sorry, I should have been clearer. Let's say you run the monitor in cron every 10 minutes:
  • try to open /tmp/monitor_info
  • if non-existent, generate pid/procname list, write to /tmp/monitor_info and exit
  • read file data into array/hash
  • generate pid/procname list using aforementioned ps command
  • compare lists. If same pair shows up in both, kill it (it's been running longer than 10 minutes).
  • write new list to /tmp/monitor_info
Adjust cron interval to be a time comfortable to ensuring that process is broken. It is a little more complicated if you have processes that have different 'comfort intervals', but you could simply include a count to each line in /tmp/monitor_info to manage this.

This script is short and easy. Does that make sense?

fnord

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://783628]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2024-04-25 11:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found