I have a perl script runs in cron and if the script fails to run it leaves behind a lock file to prevent the script to run again.
I'm trying to run a bash script that checks if the process is running and checks to see if a lock file is left behind
if processes is running and lock file exists exit 0;
if process is not running and lock file exists rm lockfile. exit 0;
if process does not exist and lock file is 'not present' exit 0;
I've been checking if the process exists running ps ax |grep -v grep |grep process.pl
I'm looking for the conditionals in bash that I should be running here.
Thanks