Hello,

I tought I'd share the scripts I use to bring wwwoffle on- or off-line
depending on whether the default route interface goes up or down.
(They were adapted from the 1wwwoffle script im /etc/ppp.)

While probably not suited for general usage, they might be shipped as
examples.

-- 
Riccardo Murri
#!/bin/sh
#
# (this goes in etc/network/if-up.d/wwwoffle)

# check for default route over this interface; if the default route
# has nothing to do with this interface, don't modify wwwoffle's
# status.

# apparently it sometimes takes the kernel a moment to create
# the route after a 'route add'...
sleep 1

# if this interface is not the default route one (check in
# /proc/net/route), then exit and don't touch wwwoffle.
if ! egrep -q "^$IFACE[[:space:]]+00000000" /proc/net/route; then
    exit 0
fi

# See /usr/share/doc/wwwoffle/README.Debian for reasons not to 
# restart wwwoffle here.
    
# put wwwoffle in online mode
/usr/bin/wwwoffle -c /etc/wwwoffle/wwwoffle.conf -online

# optionally fetch marked pages
if grep -qsx fetch /etc/wwwoffle/wwwoffle.options; then
    /usr/bin/wwwoffle -c /etc/wwwoffle/wwwoffle.conf -fetch
fi
#!/bin/sh
#
# (this goes in /etc/network/if-down.d/wwwoffle)

# if the default route goes through the interface we are about to
# bring down, then put wwwoffle in offline mode.
if egrep -q "^$IFACE[[:space:]]+00000000" /proc/net/route; then
  /usr/bin/wwwoffle -c /etc/wwwoffle/wwwoffle.conf -offline
else
  exit 0
fi

Reply via email to