Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 May 1999 00:54:38 +0200
From:      Marcel Moolenaar <marcel@scc.nl>
To:        isdn@FreeBSD.ORG
Subject:   Rename on SIGUSR1 for isdnd
Message-ID:  <3741EFAE.5C0BFD63@scc.nl>

next in thread | raw e-mail | index | archive | help
Hi,

Below is a small set of patches to change the behaviour of isdnd when it's
send a SIGUSR1 signal. Without the patches, isdnd simply closes and reopens
the acctfile and logfile (if applicable). With the patches, isdnd closes the
files and renames them, after which fresh files are created. I saw the need
when I started making daily accounting summaries and needed a way to recycle
the acctfile without loosing or duplicating accounting data. Maybe it is of
use for others too...

Index: isdnd.h
===================================================================
RCS file: /home/ncvs/src/usr.sbin/i4b/isdnd/isdnd.h,v
retrieving revision 1.2
diff -r1.2 isdnd.h
507a508
> char logfilelast[MAXPATHLEN] = LOG_FILE_DEF ".last";
519a521
> char acctfilelast[MAXPATHLEN] = ACCT_FILE_DEF ".last";
585a588
> char logfilelast[MAXPATHLEN];
596a600
> char acctfilelast[MAXPATHLEN];
Index: main.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/i4b/isdnd/main.c,v
retrieving revision 1.2
diff -r1.2 main.c
166a167,168
>                               strcpy(logfilelast, optarg);
>                               strcat(logfilelast, ".last");
680a683,684
>               rename(acctfile, acctfilelast);
> 
691a696,697
> 
>               rename(logfile, logfilelast);
Index: rc_config.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/i4b/isdnd/rc_config.c,v
retrieving revision 1.2
diff -r1.2 rc_config.c
214a215,216
>                       strcpy(acctfilelast, yylval.str);
>                       strcat(acctfilelast, ".last");


-- 
Marcel Moolenaar                                  mailto:marcel@scc.nl
SCC Internetworking & Databases                     http://www.scc.nl/
Amsterdam, The Netherlands                         tel: +31 20 4200655


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-isdn" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3741EFAE.5C0BFD63>