how can the linux system automatically check to see if an application is running ? - Linux

This is a discussion on how can the linux system automatically check to see if an application is running ? - Linux ; please help !!!...

+ Reply to Thread
Results 1 to 2 of 2

Thread: how can the linux system automatically check to see if an application is running ?

  1. how can the linux system automatically check to see if an application is running ?

    please help !!!

  2. Re: how can the linux system automatically check to see if an applicationis running ?

    Write a script 'check.sh' like this:


    #!/bin/sh
    BIN=/path/to/your/bin
    PS=`ps x`
    if echo ${PS} | grep ${PROGRAM} > /dev/null; then
    echo "Program is running."
    else
    echo "Program is not running."
    fi
    # end of script


    and add this line to your crontab file (man crontab for more help):


    */15 * * * * username if [ -x /path/to/check.sh ]; then nice
    -n10 path/to/check.sh; fi


    This will check every 15 minutes if your application is running.


    Regards.

    Sam

    -=-=-
    Never learn to do anything. If you don't learn, you will
    always find someone else to do it for you. -- Mark Twain

    * Powerd by TagZilla 0.041


+ Reply to Thread