Hrmn. A Good Idea (tm) but the "service" routine isn't on my system. What
are you running?

I've taken your code and rewritten it to be more linux distro agnostic:

if ps ax | grep ntop > /dev/null 2>&1
        then :
                else /etc/init.d/ntop restart > /dev/null 2>&1
        exit 0
fi

Ian

------------
Dr Ian Firla
Robert Graves Trust             | "A partial count of the software available
St John's College, Oxford       | in just one noncommerical Linux system
OX1 3JP - +44-(0)7855-310565    | would have cost about $1.9 billion to develop
http://www.robertgraves.org     | ... the way Microsoft does it" Bruce Perens


On Wed, 25 Sep 2002, Arnt Karlsen wrote:

> [root@lana /]# tail -n 1 /etc/crontab
> 0-59/1 * * * * ntop /usr/local/sbin/chk-ntop
> [root@lana /]# ll -G /usr/local/sbin/*ntop
> -rwxr-x---    1 ntop          130 Sep 25 05:13 /usr/local/sbin/chk-ntop
> -rwxr-x---    1 ntop           96 Sep 25 04:52 /usr/local/sbin/chk.ntop
> [root@lana /]# cat
> /usr/local/sbin/chk-ntop
> #!/bin/bash
> if service ntop status | grep running > /dev/null 2>&1
>         then :
>         else service ntop restart > /dev/null 2>&1
> exit 0
> fi
>
> [root@lana /]# cat /usr/local/sbin/chk.ntop
> #!/bin/bash
> if service ntop status | grep running
>         then :
>         else service ntop restart
> exit 0
> fi
> [root@lana /]#
>
>
> --
> ..med vennlig hilsen = with Kind Regards from Arnt... ;-)
> ...with a number of polar bear hunters in his ancestry...
>   Scenarios always come in sets of three:
>   best case, worst case, and just in case.
>
> _______________________________________________
> Ntop mailing list
> [EMAIL PROTECTED]
> http://lists.ntop.org/mailman/listinfo/ntop
>

_______________________________________________
Ntop mailing list
[EMAIL PROTECTED]
http://lists.ntop.org/mailman/listinfo/ntop

Reply via email to