Shell Script Produces Several Child Processes
(Doc ID 2019853.1)
Last updated on SEPTEMBER 06, 2019
Applies to:
Solaris Operating System - Version 8 2/04 U8 and laterInformation in this document applies to any platform.
Symptoms
A shell script may try to verify that it is the only copy running by doing something similar to "ps -ef | grep script | grep -v grep | wc -l" and expecting the value to be 1
An example would be:
Note the shell can be /bin/sh or /bin/bash or other shell, they should all work similarly
$ cat test-ra.sh
#!/bin/sh
working_num=`ps -ef |grep test-ra.sh |grep -v grep|wc -l`
if test $working_num -gt 1
then
echo "Another process_check.sh script is still working..."
exit 1
fi
#!/bin/sh
working_num=`ps -ef |grep test-ra.sh |grep -v grep|wc -l`
if test $working_num -gt 1
then
echo "Another process_check.sh script is still working..."
exit 1
fi
Changes
N/A or anything that changes the timing
Cause
To view full details, sign in with your My Oracle Support account. |
|
Don't have a My Oracle Support account? Click to get started! |
In this Document
Symptoms |
Changes |
Cause |
Solution |