54 lines
1.4 KiB
Bash
54 lines
1.4 KiB
Bash
#!/bin/sh
|
|
|
|
# Very simple reload default for the chargemax feature of isdnlog.
|
|
# This is called by isdnlog every time we get a AOCD and chargesum of
|
|
# active device is greater than CHARGEMAX.
|
|
# there are three parameters available:
|
|
#
|
|
# first ($1) is chargesum-CHARGEMAX
|
|
# second ($2) is ALIAS as defined in ISDNLOG.CONF
|
|
# third ($3) is total chargesum for active device
|
|
|
|
msg=`tempfile -p isdn`
|
|
|
|
myecho() {
|
|
echo "$@" >> $msg
|
|
}
|
|
|
|
case "$1" in
|
|
5\.*)
|
|
myecho "WARNING, charge-limit set by CHARGEMAX is reached!"
|
|
myecho "$2 is talking too much!"
|
|
# /bin/play /usr/sounds/attention.au
|
|
;;
|
|
|
|
10\.* | 11\.* )
|
|
myecho "WARNING, $2 got charge-overflow == $1, total chargesum == $3"
|
|
myecho "next chargeint will cause i4l to stop"
|
|
# /bin/play /usr/sounds/earthdestruction.au
|
|
;;
|
|
|
|
20\.* | 21\.* )
|
|
myecho "reload got charge-overflow == $1, now ipppd will be stopped!"
|
|
/sbin/init.d/isdnutils stop ipppd
|
|
;;
|
|
|
|
25\.* | 26\.* )
|
|
# echo "aeh, still alive?! so we'll do a reboot!!" >> /dev/console
|
|
# /bin/play /usr/sounds/crash.au
|
|
# /sbin/reboot
|
|
myecho "still alive?! Stopping ISDN subsystem!"
|
|
/usr/sbin/isdnctrl system off
|
|
;;
|
|
esac
|
|
|
|
myecho "got charge_ov=$1 dev=$2 scharge=$3 "
|
|
|
|
if [ -s "$msg" ]; then
|
|
logger -f $msg -p daemon.notice -t isdnlog
|
|
cat $msg >> /dev/console
|
|
fi
|
|
rm -f $msg
|
|
|
|
exit 0
|