Hi ,
I am refering to this particular exmaple that you have provided me.
Code:
#!/bin/csh
set numprocs=`ps -ef | grep -v grep | grep $scriptname | wc -l | awk '{ print $1 }'`
if ($numprocs == 1) then
# carry on
else
echo "Another instance is already running, exiting..."
exit 0
endif
What is the significance of the numprocs?
If it equals to 1 , why does it show that the script is not running anymore?
I tried a simple csh script below and it doesn;t really work.
When it is sleeping, the name of the script which is "
myscriptname" is not reflected during
" ps -ef ", it only shows "
usr 28951 28941 0 15:00:39 pts/7 0:00 sleep 100 ".
Can you help ?
Code:
#!/bin/csh
echo xxx
echo ppp
echo zzz
sleep 100