Welcome to the Linux Foundation Forum!

Cron Job

Good day!

How can i check the specific cron job is running? I'm planning to create a script which is do the checking if my cron job is running then if not, the script would execute the cron job again..

Thanks in advance!

God bless you all!


  • mfillpot
    mfillpot Posts: 2,177
    You can write a script that used lsof to track if you script file is in use, or ps to track if an application is running, then choose the appropriate actions based upon the results.

    The code below can be used as a base to track if a file is in use and you can adjust the conditional criteria to fit your needs.
    if [ -n "$(lsof|grep -i $SCRIPT)" ]; then                                                                                                                                                      
            echo "$SCRIPT is running"                                                                                                                                                              
            echo "$SCRIPT is not running"                                                                                                                                                          
  • Wow! Mr. mfillpot your great..

    it helps me a lot..

    thank you and god bless you!


Upcoming Training