well, her is an other solution which I use when a script should start, check himself and exit when running.
I use it when the first script can not be killed due to some important jobs like backups and it takes longer.
This script starts and exit himself when pid exists.
if [ ! -n "`pidof yourscript`" ] ; then
echo "script not runing"
#do your job here
else
echo "script running"
#here you do nothing, therefore it ends himself when one instance is running
fi
have fun




Reply With Quote
