#!/bin/sh -e
## This script is run when the ppp link goes down.

PATH=/bin:/sbin:/usr/bin:/usr/sbin

# Check for ISDN or diald in autodial mode.
mode=offline
if [ $PPP_IFACE = ippp0 -a -n "`isdnctrl dialmode ippp0 | grep auto`" ]; then
	mode=autodial
elif [ -n "`ps cax |grep diald`" ]; then
	mode=autodial
fi
wwwoffle -c /etc/wwwoffle/wwwoffle.conf -$mode;

# we index the cached paged from the last session and merge them
# with the big wwwoffle-htdig index. This should be fast.
if [ -x /usr/bin/htdig ]; then
	wwwoffle-htdig-lasttime
fi
