[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Quick way to tell if online for use in cron script?



	Subject: Quick way to tell if online for use in cron script?
	Date: Tue, Nov 07, 2000 at 10:42:17PM -0800

In reply to:Willy Lee

Quoting Willy Lee(willy2@jps.net):
> Hi debian-users,
> 
> I wanted to run 'ntpdate' periodically via a cron script.  However, I
> would prefer if the script would only run ntpdate if I am online (my
> dialup account), in order to avoid filling up my logs with 'can't find
> xxx.xxx.xxx.xxx' messages.  Is there something in /proc or a simple
> command that I could use to tell whether I'm dialed up?  Currently I
> am simply running 'ifconfig ppp0' to see if I'm online, but that seems
> a little inelegant to me.
> 
> This is the line I'm using currently:
> 
> 39 *     * * *     nobody  /sbin/ifconfig ppp0 &&
> /etc/init.d/ntpdate start
> 
> Thanks,
> 
This may help

____[ cut here ]____
#!/bin/sh
# Script to inform users that ppp is up
# 
# Called from cron every 5 minutes

if [ -e /var/run/ppp0.pid ]; then
  /usr/local/bin/play /usr/lib/sounds/pppisup.au
fi

____[ cut here ]____


-- 
Real programmers don't write in BASIC.  Actually, no programmers write
in BASIC after reaching puberty.
_______________________________________________________



Reply to: