At 07:51 PM 4/18/00 +0200, Gustav Schaffter wrote:
>Hi,
>
>I know I've seen a recipe for this somewhere sometime.
>
>I want to let cron execute a script on regular intervals. This script
>shall look upon the state of my serial port ppp0. If ppp0 is up, then
>certain commands should be executed, otherwise not.
>
>I know that I could use ip-up and ip-down to write some 'indicator file'
>that I can let my new script read and interpret.
>
>But...
>
>I have seen a very elegant solution described (unfortunately I can't
>find it back) where the script looked upon something in the system to
>find out the state of ppp0. May eventually have been something under
>/dev but I really don't remember.
>
>Anyone understand what I'm talking about? ;-)
>
>Anyone have any ideas of how to realize this?
>
>Best regards
>Gustav
>
If you use ifup ppp0 to start it (or usernet), you can check the status
file in /var/run. This will exit if ppp0 isn't up.
if [ ! -f /var/run/ppp-ppp0.dev ]; then
exit 0
fi
Another way is to do an ifconfig and grep for ppp0. Something like:
if ! /sbin/ifconfig | grep ppp0 > /dev/null ; then
exit 0
fi
I am sure there are other ways...
Mikkel
--
Do not meddle in the affairs of dragons,
for you are crunchy and taste good with ketchup.
--
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.