SUMMARY: find out one's own PID when running from cron
- From: "Cohen, Andy" <Andy.Cohen@xxxxxxxxxx>
- Date: Fri, 19 May 2006 12:28:37 -0400
I've already got a summary:
If your script is sh or ksh, so $$ will contain the PID of your
running script.
So I just did a:
export MY_PID=$$
And it worked PERFECTLY!
Thanks to Jean-Marc Vincent at HP.
Andy
ORIGINAL QUESTION
=================
Hi,
I have a shell script that runs from cron. It needs to check if there
are still previous runs of itself still running and if so it needs to
kill them (but not kill itself). I can get the shell script to find all
currently running copies of this script but the list includes the
current one but I only want to kill the previous ones. How do I get the
shell script to find out its own PID? I can do it at the command line
but when I try to do it when the script runs from cron I get an error
message:
ps: no controlling terminal
Thanks,
Andy
- Follow-Ups:
- accessing DISK_SPECIFIC structure
- From: Dave Simmonds
- accessing DISK_SPECIFIC structure
- Prev by Date: find out one's own PID when running from cron
- Next by Date: Administrivia: Tru64-UNIX-Managers information and policy statement
- Previous by thread: find out one's own PID when running from cron
- Next by thread: accessing DISK_SPECIFIC structure
- Index(es):
Relevant Pages
|
|