Hi,

Want to know where can I set an if condition to check for a currently running process, if that process is running, then do not execute. Else, execute. Can I set that condition inside the script itself?

If the script is called my_script.sh, in the start of the script, check to see if a PID for this scheduled script is already running, if so...do not execute. ( I want the previous one to finish)

like

CHECK=$(pgrep my_script.sh)
if [[ -z "$CHECK"]] then ;
my_script.sh starts here