You can control this using a simple lock file signal. The script checks to see if there is a file present and if so, doesn't run the bulk of the script again. If the lock file doesn't exist, it creates one, runs its tasks, and then deletes the lock file again.
See example below
if [ -f /tmp/mylockFile ] ; then echo 'Script is still running' else echo 1 > /tmp/mylockFile /* Do the main processing of your script in here */ rm -f /tmp/mylockFile fi
Well, I think this post is well-intentioned, but raises more issues than it
solves.
#echo Checking pidfile $pidfile
if ; then
pid=cat $LOCK
procfile=/proc/$pid
if ; then
true
return
fi
fi
false
--kirby