writing a continuous checking script. - Questions

This is a discussion on writing a continuous checking script. - Questions ; Does anyone know how to create a script/crotnab entry whereby i can start a service/script at a specific time and then check if it is running after every 2 mins. for. eg. i have a dial-up script it should start ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: writing a continuous checking script.

  1. writing a continuous checking script.

    Does anyone know how to create a script/crotnab entry whereby i can
    start a service/script at a specific time and then check if it is
    running after every 2 mins.

    for. eg.

    i have a dial-up script
    it should start at 9am
    stop at 6pm
    but inbetween after every 2mins a check should be performed to see if
    it is running, else start it.
    also this check should be performed only between 9am till 6pm

  2. Re: writing a continuous checking script.

    On 14 Sep 2004 07:07:35 -0700, DukeNM wrote:
    > Does anyone know how to create a script/crotnab entry whereby i can
    > start a service/script at a specific time and then check if it is
    > running after every 2 mins.
    >
    > for. eg.
    >
    > i have a dial-up script
    > it should start at 9am
    > stop at 6pm
    > but inbetween after every 2mins a check should be performed to see if
    > it is running, else start it.
    > also this check should be performed only between 9am till 6pm


    Well, have cron run your script at 9am. Then create a loop in
    the scrpt which checks to see if time is 18 and exit.
    Next test if dial-up is not running and start it.
    sleep for 2 minutes.

    Need some scripting examples:
    http://www.tldp.org/LDP/abs/html/index.html

  3. Re: writing a continuous checking script.

    In article <1d368440.0409140607.e052110@posting.google.com>, DukeNM wrote:
    >Does anyone know how to create a script/crotnab entry whereby i can
    >start a service/script at a specific time and then check if it is
    >running after every 2 mins.


    There are other ways, but start with this HOWTO:

    31540 Jul 27 2000 Bash-Prog-Intro-HOWTO

    and then go to the Linux Documentation Project and get these two books

    ../docs/linux-doc-project/Bash-Beginners-Guide:
    total 2148
    412834 Jul 10 10:37 Bash-Beginners-Guide.html.tar.gz
    176716 Jul 10 10:37 Bash-Beginners-Guide.pdb
    828584 Jul 10 10:37 Bash-Beginners-Guide.pdf
    628707 Jul 10 10:37 Bash-Beginners-Guide.ps.gz
    119627 Jul 10 10:37 Bash-Beginners-Guide.txt.gz

    ../docs/linux-doc-project/abs-guide:
    total 2832
    410623 Jul 12 09:14 abs-guide.html.tar.gz
    432281 Jul 12 09:14 abs-guide.pdb
    1160703 Jul 12 09:14 abs-guide.pdf
    491365 Jul 12 09:14 abs-guide.ps.gz
    376508 Jul 12 09:14 abs-guide.txt.gz

    You only need one copy - the html.tar.gz version is probably best. Try
    http://en.tldp.org/HOWTO/HOWTO-INDEX/howtos.html

    >i have a dial-up script
    >it should start at 9am


    cron entry - run the script at 9 AM

    >stop at 6pm


    cron entry - 'kill -term' the dial-up script.

    >but inbetween after every 2mins a check should be performed to see if
    >it is running, else start it.


    man pppd look at the 'persist' option.

    >also this check should be performed only between 9am till 6pm


    Not needed with the 'persist' option.

    What I would do would be to use the 9 AM cron entry to run a script that
    starts pppd with the persist option, and kicks it into the background.
    For the 6 PM cron job, I'd simply use

    killall -term pppd

    See the man page for pppd, crontab, and killall. No need to make this
    any more complicated than it needs to be.

    Old guy

+ Reply to Thread