isdnlog enhancments
taken from Debian sid isdnlog-diffs.patch without the directory change for the logfile Signed-off-by: Karsten Keil <kkeil@linux-pingi.de>
This commit is contained in:
parent
1260aa752f
commit
dce2c7ee85
|
@ -0,0 +1,18 @@
|
||||||
|
V:-0.1 default [2001/10/10]
|
||||||
|
|
||||||
|
W:1 Monday
|
||||||
|
W:2 Tuesday
|
||||||
|
W:3 Wednesday
|
||||||
|
W:4 Thursday
|
||||||
|
W:5 Friday
|
||||||
|
W:6 Saturday
|
||||||
|
W:7 Sunday
|
||||||
|
W:W weekday
|
||||||
|
W:E weekend
|
||||||
|
W:H holiday
|
||||||
|
W:* everyday
|
||||||
|
|
||||||
|
D:1.1 New Year's Day
|
||||||
|
D:easter Easter
|
||||||
|
D:1.5 May Day
|
||||||
|
D:25.12 Christmas
|
|
@ -0,0 +1,12 @@
|
||||||
|
V:0.01-default [2001/10/10]
|
||||||
|
|
||||||
|
U:%.3f UNITS
|
||||||
|
|
||||||
|
P:10 .
|
||||||
|
B:1234
|
||||||
|
D:x
|
||||||
|
|
||||||
|
# 1 currency unit per minute
|
||||||
|
Z:1 .
|
||||||
|
A:*
|
||||||
|
T:*/*=1.00/60
|
|
@ -0,0 +1 @@
|
||||||
|
P:10
|
|
@ -1,37 +1,53 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# very simple reload-example for the new chargemax feature of isdnlog
|
# Very simple reload default for the chargemax feature of isdnlog.
|
||||||
# this is called by isdnlog every time we get a AOCD and chargesum of
|
# This is called by isdnlog every time we get a AOCD and chargesum of
|
||||||
# active device is greater then CHARGEMAX.
|
# active device is greater than CHARGEMAX.
|
||||||
# there are three parameter available:
|
# there are three parameters available:
|
||||||
#
|
#
|
||||||
# first ($1) is chargesum-CHARGEMAX
|
# first ($1) is chargesum-CHARGEMAX
|
||||||
# second ($2) is ALIAS as defined in ISDNLOG.CONF
|
# second ($2) is ALIAS as defined in ISDNLOG.CONF
|
||||||
# third ($3) is total chargesum for active device
|
# third ($3) is total chargesum for active device
|
||||||
|
|
||||||
|
msg=`tempfile -p isdn`
|
||||||
|
|
||||||
|
myecho() {
|
||||||
|
echo "$@" >> $msg
|
||||||
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
5\.*)
|
5\.*)
|
||||||
echo "WARNING, charge-limit set by CHARGEMAX is reached!" >> /dev/console
|
myecho "WARNING, charge-limit set by CHARGEMAX is reached!"
|
||||||
echo "$2 is talking to much!" >> /dev/console
|
myecho "$2 is talking too much!"
|
||||||
# /bin/aplay /usr/sounds/attention.au
|
# /bin/play /usr/sounds/attention.au
|
||||||
;;
|
;;
|
||||||
|
|
||||||
10\.* | 11\.* )
|
10\.* | 11\.* )
|
||||||
echo "WARNING, $2 got charge-overflow == $1, total chargesum == $3" >> /dev/console
|
myecho "WARNING, $2 got charge-overflow == $1, total chargesum == $3"
|
||||||
echo "next chargeint will cause i4l to stop" >> /dev/console
|
myecho "next chargeint will cause i4l to stop"
|
||||||
# /bin/aplay /usr/sounds/earthdestruction.au
|
# /bin/play /usr/sounds/earthdestruction.au
|
||||||
;;
|
;;
|
||||||
|
|
||||||
20\.* | 21\.* )
|
20\.* | 21\.* )
|
||||||
echo "reload got charge-overflow == $1, now i4l will be stopped!" >> /dev/console
|
myecho "reload got charge-overflow == $1, now ipppd will be stopped!"
|
||||||
/sbin/init.d/i4l stop
|
/sbin/init.d/isdnutils stop ipppd
|
||||||
;;
|
;;
|
||||||
|
|
||||||
25\.* | 26\.* )
|
25\.* | 26\.* )
|
||||||
echo "aeh, still alive?! so we'll do a reboot!!" >> /dev/console
|
# echo "aeh, still alive?! so we'll do a reboot!!" >> /dev/console
|
||||||
# /bin/aplay /usr/sounds/crash.au
|
# /bin/play /usr/sounds/crash.au
|
||||||
/sbin/reboot
|
# /sbin/reboot
|
||||||
|
myecho "still alive?! Stopping ISDN subsystem!"
|
||||||
|
/usr/sbin/isdnctrl system off
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
echo "got charge_ov=$1 dev=$2 scharge=$3 " >> /dev/console
|
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
|
||||||
|
|
|
@ -43,15 +43,15 @@ distclean: clean
|
||||||
-rm config.{status,log,h,cache} Makefile .depend
|
-rm config.{status,log,h,cache} Makefile .depend
|
||||||
|
|
||||||
install-dirs:
|
install-dirs:
|
||||||
install -d -m0755 $(MAN1DIR) $(MAN3DIR) $(LIBDIR) $(BINDIR) \
|
install -d -m0755 $(MAN1DIR) $(MAN3DIR) $(LIBDIR) $(BINDIR) $(INCDIR)
|
||||||
$(INCDIR)
|
|
||||||
|
|
||||||
install:
|
install:
|
||||||
install -m0755 $(BINS) $(BINDIR)
|
true
|
||||||
install -m0644 $(MAN1) $(MAN1DIR)
|
# install -m0755 $(BINS) $(BINDIR)
|
||||||
install -m0644 $(MAN3) $(MAN3DIR)
|
# install -m0644 $(MAN1) $(MAN1DIR)
|
||||||
install -m0644 $(LIBS) $(LIBDIR)
|
# install -m0644 $(MAN3) $(MAN3DIR)
|
||||||
install -m0644 freecdb.h freecdbmake.h $(INCDIR)
|
# install -m0644 $(LIBS) $(LIBDIR)
|
||||||
|
# install -m0644 freecdb.h freecdbmake.h $(INCDIR)
|
||||||
|
|
||||||
cdbdump: cdbdump.o cdb_unpack.o
|
cdbdump: cdbdump.o cdb_unpack.o
|
||||||
|
|
||||||
|
|
|
@ -145,8 +145,9 @@ Connect to a running isdnrate daemon. This avoids long startup times.
|
||||||
.P
|
.P
|
||||||
.B \-D
|
.B \-D
|
||||||
Start as a daemon, waiting for connections from a client. The socket
|
Start as a daemon, waiting for connections from a client. The socket
|
||||||
.I /tmp/isdnrate
|
.I /var/run/isdnrate/socket
|
||||||
is created, which clients can connect to.
|
is created, which clients can connect to
|
||||||
|
(the socket can be changed by using the -O option).
|
||||||
.P
|
.P
|
||||||
.B \-D2
|
.B \-D2
|
||||||
Start as a daemon and go background.
|
Start as a daemon and go background.
|
||||||
|
@ -171,8 +172,8 @@ Show info about following numbers. If no provider is given, the preselected
|
||||||
provider is used.
|
provider is used.
|
||||||
.P
|
.P
|
||||||
.BI \-O socketfile
|
.BI \-O socketfile
|
||||||
Write socket to given filename on start of daemon. Default is
|
Use given filename as the socket on start of daemon. Default is
|
||||||
.IR tmp/isdnrate .
|
.IR /var/run/isdnrate/socket .
|
||||||
.P
|
.P
|
||||||
.BI \-P piddir
|
.BI \-P piddir
|
||||||
Write own PID to
|
Write own PID to
|
||||||
|
|
|
@ -622,6 +622,13 @@
|
||||||
|
|
||||||
#define _GNU_SOURCE 1
|
#define _GNU_SOURCE 1
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <sys/times.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/resource.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
@ -630,12 +637,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/time.h>
|
|
||||||
#include <sys/times.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/wait.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
|
|
@ -523,7 +523,8 @@ static int _getZ(struct sth *sthp, char *from, char *sto) {
|
||||||
from=sto;
|
from=sto;
|
||||||
sto=temp;
|
sto=temp;
|
||||||
}
|
}
|
||||||
strncpy(newfrom, from, LENGTH-1);
|
if (newfrom != from)
|
||||||
|
memmove(newfrom, from, LENGTH-1);
|
||||||
while (strlen(newfrom)) {
|
while (strlen(newfrom)) {
|
||||||
UL lifrom = (UL) atol(newfrom); /* keys could be long */
|
UL lifrom = (UL) atol(newfrom); /* keys could be long */
|
||||||
US ifrom = (US) lifrom;
|
US ifrom = (US) lifrom;
|
||||||
|
|
Loading…
Reference in New Issue