Gustav Schaffter wrote:
> 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.
This may not be elegant, but it works:
#!/bin/bash
#
# Count the number of lines in the
# routing table that refer to ppp0.
let pppstatus=`/sbin/route -n | /bin/grep -c 'ppp0$'`
# If there is at least one line ending with ppp0,
# then print the approriate message.
if [ $pppstatus -gt 0 ] ; then
echo 'ppp0 is up'
else
echo 'ppp0 is down'
fi
--
Anthony E. Greene <[EMAIL PROTECTED]>
Homepage & PGP Key <http://www.pobox.com/~agreene/>
Linux: The choice of a GNU Generation.
--
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.