Quick question about finding the PID of long-running processes


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Quick question about finding the PID of long-running processes
# 1  
Old 07-16-2012
Quick question about finding the PID of long-running processes

The end result that I'd like is to terminate any process on my ps -u username list that extends beyond 20 minutes. I know for a fact that this process will be named l[0-999].exe, but I don't know the number in between and I won't know the PID. Is there a way to use grep or pidof to do this task every 20 minutes or so?

Thanks!
# 2  
Old 07-16-2012
The proper way to do this, instead of grepping ps and hoping nothing goes wrong or false matches don't turn up, would be to save the PID in the first place so you can look it up later, usually in a PID file. How is this process being launched?
# 3  
Old 07-16-2012
The problem is that the PID and the process name is always being changed. The only thing that is relatively constant is the time iteration. I myself don't know the way this is being done because it was coded by someone else, but I do know that I occasionally have to kill anything that the system gets caught up on. The arbitrary value that the group I'm working in has set the system caught time to 20 minutes.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Need to check long running processes on the database server and the os is AIX

Hello, Please help me with a script with which I can check long running processes on the database server and the os is AIX. Best regards, Vishal (5 Replies)
Discussion started by: Vishal_dba
5 Replies

2. AIX

How to Identify long running unix processes

Hi All, Need an urgent help, I have a requirement to find long running unix processes.. I have tried the below commands, but not succeed. I need to arrange the unix processess in an order of elapsed time (high to low) that runs in a system. For Eg: Consider we have 3 processes, Pid 1 pid 2... (5 Replies)
Discussion started by: mohamedirfan
5 Replies

3. Shell Programming and Scripting

determine the active processes on the system which are running since long time

Hi , Please help me shell script to determine the active processes on the system which are running since long time (2 Replies)
Discussion started by: itian2010
2 Replies

4. Shell Programming and Scripting

Finding the age of a unix process, killing old processes, killing zombie processes

I had issues with processes locking up. This script checks for processes and kills them if they are older than a certain time. Its uses some functions you'll need to define or remove, like slog() which I use for logging, and is_running() which checks if this script is already running so you can... (0 Replies)
Discussion started by: sukerman
0 Replies

5. UNIX for Dummies Questions & Answers

Run Processes Sequentially Using Process ID (PID)

Hi, I'm a newbie when it comes to using UNIX, and I'm hoping someone here can help me out. I have a set of processes that I want to run sequentially: process1.py process2.py process3.py I want to know I can run these sequentially using their process IDs (PIDs). Ideally, I want to... (2 Replies)
Discussion started by: shelata
2 Replies

6. Shell Programming and Scripting

Script for long running processes....

I searched the forums but didn't see anything related to what I'm looking for. I need a script that would give me a listing of jobs running longer than, for example, 12 hours or so. Thanks in advance for your assistance!! (2 Replies)
Discussion started by: CyberOptiq
2 Replies

7. Shell Programming and Scripting

Finding the nice(ni) number with PID?

Hi, is there a command that takes the PID of a process and that only diplays it's ni number? I`m pretty sure it would require pipes but I tried a few things that ended up miserably... Since the ps command doesn't show the ni unless I do ps -o ni but then I can't find a way to search the right... (2 Replies)
Discussion started by: Yakuzan
2 Replies

8. UNIX for Dummies Questions & Answers

Quick question about finding a large file

what is the correct command for finding the largest file and displaying it without any error information? I can find it, but how do I display it in the same command? (6 Replies)
Discussion started by: raidkridley
6 Replies

9. Shell Programming and Scripting

long runnning processes more than one hour not able to see in ps -ef command

hi, We have one script ‘X' which invokes another script ‘Y'. Inside X we are checking if Y is active/running or not with ps command. But for cases when Y runs for more than 1 hour the ps command inside X returns that no Y process running. Can you please guide me if in UNIX any long running process... (4 Replies)
Discussion started by: shyam soni
4 Replies

10. UNIX for Dummies Questions & Answers

Controlling processes knowing the PID's

Dear all, suppose that I start a process (named "father"). "father" starts in turns a process called "child" with an execv call (after a fork). In this way "father" will be notified if "chlid" crashes (SIGCHILD mechanism). The problem is: if "father" crashes, how can I do to be recreate a... (1 Reply)
Discussion started by: npalmentieri
1 Replies
Login or Register to Ask a Question