![]() |
|
|
|
|
|||||||
| 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 exclude the GREP command from GREP | yamsin789 | UNIX for Advanced & Expert Users | 2 | 10-04-2007 11:59 PM |
| script to run shell command and insert results to existing xml file | littlejon | Shell Programming and Scripting | 5 | 08-12-2005 01:59 PM |
| find command not returning any result | rraajjiibb | UNIX for Advanced & Expert Users | 4 | 07-23-2004 02:05 PM |
| grep for a process | bensky | UNIX for Dummies Questions & Answers | 3 | 10-23-2003 01:00 AM |
| SED Command Returning a Blank File | djschmitt | UNIX for Dummies Questions & Answers | 2 | 02-27-2003 01:13 PM |
|
|
LinkBack | Thread Tools | Display Modes |
| Forum Sponsor | ||
|
|
|
|||
|
You could create a lock file, by adding something like the following to the beginning of the background script:
if [ -r lockfile.pid ] then echo "Background Process already running " exit 1 else echo $$ >lockfile.pid fi Then at the end of the background process, and in the system start up process add: rm lockfile.pid Then have the foreground application test for the existence of the lock file. As for why the ps command doesn't always work, is it possible that the pid number disappears from the process list when the process is swapped out. |
|
||||
|
jgt,
Thanks for the reply. Using a lock file is one possibility, but I was hoping that I'd be able to resolve the ps issue. Using a lock file could put more burdon on our customers if, for example, the background process dies or is killed but the application is still running. In that case, the user would need to get to the os and delete the file manually. Not all of our customers' are technically adept. Not out of the question, but probably a last resort. As for your comment: Quote:
JL |
|
||||
|
I know nothing about AIX. But some man pages on the web for "ps" say, "Programs swapped out to disk will be shown without command line arguments, and unless the c option is given, in brackets."
It's not clear if you are grepping for command line arguments. If you are, and the program is swapped out and the AIX ps is subject to the limitation, it could be failing on the grep for command line arguments. |
|
||||
|
kahuna,
Yes, the grep is a command line argument. The process itself can be running quite a number of times; it's the main process for the application and each usr who logs in uses the same program. I guess I'll need to look at alternatives like the lock file. If AIX is swapping out that process, there's not too much I can do. It is curious that we've never, in over 10 years, see this problem. I wonder if the customer in this case changed some parameters that caused AIX to swap out processes more often. Thanks. JL |