Hi,
I have 2 scripts running at the same time through cronjob. The scripts have the same functionality except for the path names, creating log files.
The scripts are as follows.
Script A:
#!/bin/sh
RPT_TO=/home/scripta
RPT_LOG=/home/loga
V=`ps -eaf | grep AB | wc -l`
if [ $V -gt 1 ]; then
echo "Process AB is running. Exiting the script." >> $RPT_LOG/delete_a.log
exit
fi
.
.
some more processing
end of script A.
Scrpit B:
#!/bin/sh
RPT_TO=/home/scriptb
RPT_LOG=/home/logb
V=`ps -eaf | grep AB | wc -l`
if [ $V -gt 1 ]; then
echo "process AB is running. Exiting the script." >> $RPT_LOG/delete_b.log
exit
fi
.
.
some more processing
end of script B.
The cron job is set as follows.
00 19 * * 1-5 /home/loca/a.sh >> /home/loca/a.log 2>&1
00 19 * * 1-5 /home/loca/b.sh >> /home/loca/b.log 2>&1
The time when the scripts ran, AB process was not running
Scipt B ran through fine. Script A, gave the message "process AB is running. Exiting the script."
Is this because both the scripts running at the same time, doing the same process checks and using the same variable name?
What could be the reason script a is giving the message even though the process AB is not running?
Any suggestions is appreciated.
Thanks in advance.
I have 2 scripts running at the same time through cronjob. The scripts have the same functionality except for the path names, creating log files.
The scripts are as follows.
Script A:
#!/bin/sh
RPT_TO=/home/scripta
RPT_LOG=/home/loga
V=`ps -eaf | grep AB | wc -l`
if [ $V -gt 1 ]; then
echo "Process AB is running. Exiting the script." >> $RPT_LOG/delete_a.log
exit
fi
.
.
some more processing
end of script A.
Scrpit B:
#!/bin/sh
RPT_TO=/home/scriptb
RPT_LOG=/home/logb
V=`ps -eaf | grep AB | wc -l`
if [ $V -gt 1 ]; then
echo "process AB is running. Exiting the script." >> $RPT_LOG/delete_b.log
exit
fi
.
.
some more processing
end of script B.
The cron job is set as follows.
00 19 * * 1-5 /home/loca/a.sh >> /home/loca/a.log 2>&1
00 19 * * 1-5 /home/loca/b.sh >> /home/loca/b.log 2>&1
The time when the scripts ran, AB process was not running
Scipt B ran through fine. Script A, gave the message "process AB is running. Exiting the script."
Is this because both the scripts running at the same time, doing the same process checks and using the same variable name?
What could be the reason script a is giving the message even though the process AB is not running?
Any suggestions is appreciated.
Thanks in advance.