Well - I was so sure this has already been done million times over but found no leads that it has been posted yet.
I want my script to run in background, tail a logfile record changes to a SQL host and die() if it cannot connect to a SQL host. That is the easy part and dealt with.
But - I also want to start it by cron say every minute in case it is not running. More than one copy should not be running. So at the start, it should check if another copy is already running, if so, do a die immidiately otherwise continue.