![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to print parent process name | mahendramahendr | Shell Programming and Scripting | 3 | 05-23-2008 04:59 AM |
| Who is the parent of a killed process ? | Puntino | UNIX for Dummies Questions & Answers | 6 | 05-13-2008 01:50 AM |
| Can a child process return a specific value to a parent process ? | Ametis1970 | High Level Programming | 8 | 04-09-2008 08:22 PM |
| how to find the chid process id from given parent process id | guhas | Shell Programming and Scripting | 3 | 10-13-2005 05:13 AM |
| identify parent process in ps? | MizzGail | UNIX for Dummies Questions & Answers | 6 | 07-03-2002 11:37 AM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hello,
I'm running one script every night and that's kick off through cron jobs. Inside the script i'm checking whether my script is already running or not. I'm using following command to check whether is running or not. ps -eaf | grep "test_PID.ksh" | grep -v "grep test_PID.ksh" | wc -l sometime it gives me 2 process or 3 process Output: user 15243 15203 0 12:00:01 ? 0:00 /usr/bin/ksh /usr/local/my/bin/test_PID.ksh user 15203 254 0 12:00:01 ? 0:00 sh -c /usr/local/my/bin/test_PID.ksh Why am i seeing two process for one job. How can i get only parent process not child process. Thank you for your helps in adv. |
| Forum Sponsor | ||
|
|
|
|||
|
Process management
I think you're seeing two due to your invocation method. One method that would be more "tight" would be to have your process write it's PID to a PID file, or have the script write it if necessary. Then check to see if the PID is running, rather than guessing by checking for the existence of a file. ABEND-ing programs rarely clean up after themselves. PID's are either in use or not. The only possible hole in this logic is that PID's are reused periodically as the PID integer is incremented through it's max. The likelihood of that error is quite very very low.
|
| Thread Tools | |
| Display Modes | |
|
|