Google Answers Logo
View Question
 
Q: need perl script ( No Answer,   0 Comments )
Question  
Subject: need perl script
Category: Computers > Programming
Asked by: marcfest-ga
List Price: $20.00
Posted: 15 Feb 2003 18:11 PST
Expires: 21 Feb 2003 06:18 PST
Question ID: 161912
I need a perl script (which, fyi, will be run as root as a cron job).

The script takes 2 arguments, "scriptname" and "age" (in seconds).

When invoked it does the following:

1. Check for processes that are running as instantiations of a perl
script called "scriptname" (there may be more than one such process).

2. Check each such found process to see if it has been running for
more than "age" seconds. If so, kill the process.

Thanks for helping.

Marc.

Request for Question Clarification by studboy-ga on 16 Feb 2003 10:34 PST
Hi

Can you tell me the output from the following two commands?
I need to know the output format of ps on your system:

1) ps -ef
2) aux

Thanks

Clarification of Question by marcfest-ga on 16 Feb 2003 12:03 PST
[root@server1 htdocs]# ps -ef
UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0 Jan25 ?        00:00:13 init [3]
root         2     1  0 Jan25 ?        00:00:00 [keventd]
root         3     1  0 Jan25 ?        00:00:00 [kapm-idled]
root         4     0  0 Jan25 ?        00:00:00 [ksoftirqd_CPU0]
root         5     0  0 Jan25 ?        00:00:01 [kswapd]
root         6     0  0 Jan25 ?        00:00:00 [kreclaimd]
root         7     0  0 Jan25 ?        00:00:04 [bdflush]
root         8     0  0 Jan25 ?        00:00:00 [kupdated]
root         9     1  0 Jan25 ?        00:00:00 [mdrecoveryd]
root       419     1  0 Jan25 ?        00:00:41 syslogd -m 0
root       424     1  0 Jan25 ?        00:00:00 klogd -2
root       509     1  0 Jan25 ?        00:00:00 ntpd
daemon     521     1  0 Jan25 ?        00:00:00 /usr/sbin/atd
root       534     1  0 Jan25 ?        00:00:19 /usr/sbin/sshd
root       555     1  0 Jan25 ?        00:00:20 xinetd -stayalive
-reuse -pidfile /var/run/xinetd.pid
root       590     1  0 Jan25 ?        00:00:01 gpm -t ps/2 -m
/dev/mouse
root       618     1  0 Jan25 ?        00:00:01 crond
root       659     1  0 Jan25 ?        00:00:01 /usr/bin/perl
/usr/local/webmin-0.93/miniserv.pl /etc/webmin/miniserv.conf
root       669     1  0 Jan25 tty1     00:00:00 /sbin/mingetty tty1
root       670     1  0 Jan25 tty2     00:00:00 /sbin/mingetty tty2
root       671     1  0 Jan25 tty3     00:00:00 /sbin/mingetty tty3
root       672     1  0 Jan25 tty4     00:00:00 /sbin/mingetty tty4
root       673     1  0 Jan25 tty5     00:00:00 /sbin/mingetty tty5
root       674     1  0 Jan25 tty6     00:00:00 /sbin/mingetty tty6
root      1231     1  0 Jan25 ?        00:00:00 /bin/sh
/usr/bin/safe_mysqld --datadir=/var/lib/mysql --pid-file=/var/lib/mys
mysql     1253  1231  0 Jan25 ?        00:00:16 /usr/sbin/mysqld
--basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file
mysql     1255  1253  0 Jan25 ?        00:00:15 /usr/sbin/mysqld
--basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file
mysql     1256  1255  0 Jan25 ?        00:01:16 /usr/sbin/mysqld
--basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file
root      4006     1  0 Feb05 ?        00:00:08 sendmail: accepting
connections
root      1101     1  0 Feb09 ?        00:00:00 /usr/sbin/httpd
-DHAVE_PROXY -DHAVE_ACCESS -DHAVE_ACTIONS -DHAVE_ALIAS -DHAVE
root     20367   618  0 04:02 ?        00:00:00 CROND
root     20371 20367  0 04:02 ?        00:00:00 /bin/bash
/usr/bin/run-parts /etc/cron.daily
root     20380 20371  0 04:02 ?        00:00:00 awk -v
progname=/etc/cron.daily/logrotate progname {?????   print progname ":
root     20438     1  0 04:02 ?        00:00:01 portsentry -stcp
root     20440     1  0 04:02 ?        00:00:00 portsentry -udp
apache   27248  1101  0 06:05 ?        00:00:00 /usr/sbin/httpd
-DHAVE_PROXY -DHAVE_ACCESS -DHAVE_ACTIONS -DHAVE_ALIAS -DHAVE
apache   27538  1101  0 06:35 ?        00:00:00 /usr/sbin/httpd
-DHAVE_PROXY -DHAVE_ACCESS -DHAVE_ACTIONS -DHAVE_ALIAS -DHAVE
apache   27539  1101  0 06:35 ?        00:00:00 /usr/sbin/httpd
-DHAVE_PROXY -DHAVE_ACCESS -DHAVE_ACTIONS -DHAVE_ALIAS -DHAVE
apache   27540  1101  0 06:35 ?        00:00:00 /usr/sbin/httpd
-DHAVE_PROXY -DHAVE_ACCESS -DHAVE_ACTIONS -DHAVE_ALIAS -DHAVE
apache   27541  1101  0 06:35 ?        00:00:00 /usr/sbin/httpd
-DHAVE_PROXY -DHAVE_ACCESS -DHAVE_ACTIONS -DHAVE_ALIAS -DHAVE
apache   27542  1101  0 06:35 ?        00:00:00 /usr/sbin/httpd
-DHAVE_PROXY -DHAVE_ACCESS -DHAVE_ACTIONS -DHAVE_ALIAS -DHAVE
apache   27543  1101  0 06:35 ?        00:00:00 /usr/sbin/httpd
-DHAVE_PROXY -DHAVE_ACCESS -DHAVE_ACTIONS -DHAVE_ALIAS -DHAVE
apache   27544  1101  0 06:35 ?        00:00:00 /usr/sbin/httpd
-DHAVE_PROXY -DHAVE_ACCESS -DHAVE_ACTIONS -DHAVE_ALIAS -DHAVE
apache   27545  1101  0 06:35 ?        00:00:00 /usr/sbin/httpd
-DHAVE_PROXY -DHAVE_ACCESS -DHAVE_ACTIONS -DHAVE_ALIAS -DHAVE
apache   27546  1101  0 06:35 ?        00:00:00 /usr/sbin/httpd
-DHAVE_PROXY -DHAVE_ACCESS -DHAVE_ACTIONS -DHAVE_ALIAS -DHAVE
apache   27547  1101  0 06:35 ?        00:00:00 /usr/sbin/httpd
-DHAVE_PROXY -DHAVE_ACCESS -DHAVE_ACTIONS -DHAVE_ALIAS -DHAVE
apache   27548  1101  0 06:35 ?        00:00:00 /usr/sbin/httpd
-DHAVE_PROXY -DHAVE_ACCESS -DHAVE_ACTIONS -DHAVE_ALIAS -DHAVE
apache   27549  1101  0 06:35 ?        00:00:00 /usr/sbin/httpd
-DHAVE_PROXY -DHAVE_ACCESS -DHAVE_ACTIONS -DHAVE_ALIAS -DHAVE
apache   27550  1101  0 06:35 ?        00:00:00 /usr/sbin/httpd
-DHAVE_PROXY -DHAVE_ACCESS -DHAVE_ACTIONS -DHAVE_ALIAS -DHAVE
apache   27551  1101  0 06:35 ?        00:00:00 /usr/sbin/httpd
-DHAVE_PROXY -DHAVE_ACCESS -DHAVE_ACTIONS -DHAVE_ALIAS -DHAVE
apache   27552  1101  0 06:35 ?        00:00:00 /usr/sbin/httpd
-DHAVE_PROXY -DHAVE_ACCESS -DHAVE_ACTIONS -DHAVE_ALIAS -DHAVE
apache   28960  1101  0 08:25 ?        00:00:00 /usr/sbin/httpd
-DHAVE_PROXY -DHAVE_ACCESS -DHAVE_ACTIONS -DHAVE_ALIAS -DHAVE
apache   28961  1101  0 08:25 ?        00:00:00 /usr/sbin/httpd
-DHAVE_PROXY -DHAVE_ACCESS -DHAVE_ACTIONS -DHAVE_ALIAS -DHAVE
apache   28962  1101  0 08:25 ?        00:00:00 /usr/sbin/httpd
-DHAVE_PROXY -DHAVE_ACCESS -DHAVE_ACTIONS -DHAVE_ALIAS -DHAVE
apache   28963  1101  0 08:25 ?        00:00:00 /usr/sbin/httpd
-DHAVE_PROXY -DHAVE_ACCESS -DHAVE_ACTIONS -DHAVE_ALIAS -DHAVE
apache   28964  1101  0 08:25 ?        00:00:00 /usr/sbin/httpd
-DHAVE_PROXY -DHAVE_ACCESS -DHAVE_ACTIONS -DHAVE_ALIAS -DHAVE
apache   28965  1101  0 08:25 ?        00:00:00 /usr/sbin/httpd
-DHAVE_PROXY -DHAVE_ACCESS -DHAVE_ACTIONS -DHAVE_ALIAS -DHAVE
root     30093   534  0 09:04 ?        00:00:03 /usr/sbin/sshd
root     30097 30093  0 09:04 pts/2    00:00:00 -bash
root     30590   534  0 09:20 ?        00:00:02 /usr/sbin/sshd
root     30598 30590  0 09:21 pts/3    00:00:00 -bash
root      2752 30598  0 11:48 pts/3    00:00:44 top
525       8196   555  0 14:56 ?        00:00:00 ftpd: 216.189.187.137:
bnorcross: IDLE
root      8261   618  0 15:01 ?        00:00:00 CROND
root      8265  8261  0 15:01 ?        00:00:00 /bin/bash
/usr/bin/run-parts /etc/cron.hourly
root      8282  8265  0 15:01 ?        00:00:00 awk -v
progname=/etc/cron.hourly/sysstat progname {?????   print progname ":\
root      8283     1  0 15:01 ?        00:00:00 /bin/sh
/usr/lib/sa/sa1 600 6
root      8285  8283  0 15:01 ?        00:00:00 /usr/lib/sa/sadc 600 6
/var/log/sa/sa16
root      8287 30097  0 15:01 pts/2    00:00:00 ps -ef

#################################

[root@server1 htdocs]# aux
bash: aux: command not found
Answer  
There is no answer at this time.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy