
09-19-2008
|
|
Shell programmer, author
|
|
|
Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,362
|
|
Quote:
Originally Posted by nua7
Hi All,
I have a master script , which would run 4 scripts in sequence. When the first script gets executed , I need to check if a particular process has been completed. If it is completed , only then proceed with the second script.
This same rule applies to script3 and script4.
Can someone please help me out.This is the function that I wrote for the process check.
Code:
process_check ()
{
p1=`ps -ef | grep o1 |grep -v grep| wc -l`
if [ "$p1" = 0]
|
You are missing then (as well as a space before ]):
Code:
if [ "$p1" = 0 ]
then
And you don't need two greps as well as wc:
Code:
if ps -ef | grep '[o]1'
then
Quote:
|
Code:
echo "Process not running"
return 0
else
echo "Process completed"
return 1
}
|
Last edited by cfajohnson; 09-19-2008 at 03:49 AM..
|