Chad_MacArthur has asked for the wisdom of the Perl Monks concerning the following question:

G'day guys

I was wondering what kind of system commands I would use to write a program that takes 2 switch + agruments:

  1. for memory plus the memory time eg. -m 85 which finds any processes that amount or over then kills it, Displaying the name of process killed.
  2. for cpu time plus the cpu time eg. -c 97 which finds any processes that amount or over then kills it, Displaying the name of process killed.
If it does find a process that is using alot of cpu time or memory it then kills it. It sends an email to the owner of the process

Thank mate for the Help
ANy help would be Great
Chad

20040501 Edit by jdporter: Changed title from 'View current running programs - basic admin scripting!!'

Replies are listed 'Best First'.
Re: OT: View current running programs basic admin scripting!!
by Fletch (Bishop) on Apr 28, 2004 at 15:02 UTC
Re: OT: View current running programs basic admin scripting!!
by dragonchild (Archbishop) on Apr 28, 2004 at 14:04 UTC
    On Unix-like systems, I'd look at the ps command. On Windows, you'll have to play with the Win32:: suite. For other OS'es, I'm sure the solutions are there, but I have no clue what to do.

    ------
    We are the carpenters and bricklayers of the Information Age.

    Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

Re: OT: View current running programs basic admin scripting!!
by Abigail-II (Bishop) on Apr 28, 2004 at 14:04 UTC
    I'd use ps, or browse the /proc file system.

    Abigail

Re: OT: View current running programs - basic admin scripting!!
by AcidHawk (Vicar) on Apr 29, 2004 at 07:11 UTC
    Check Proclist.pl from www.roth.net for a script that list the process and some other info.
    -----
    Of all the things I've lost in my life, its my mind I miss the most.