kernel: fix LINT64 build after old SCSI drivers removal
[dragonfly.git] / etc / periodic / monthly / 200.accounting
blobc5b37249ebe0e283934e270b51ca269415c35e6a
1 #!/bin/sh -
3 # $FreeBSD: src/etc/periodic/monthly/200.accounting,v 1.4.2.5 2002/05/21 03:17:08 brian Exp $
4 # $DragonFly: src/etc/periodic/monthly/200.accounting,v 1.2 2003/06/17 04:24:48 dillon Exp $
7 # If there is a global system configuration file, suck it in.
9 if [ -r /etc/defaults/periodic.conf ]
10 then
11 . /etc/defaults/periodic.conf
12 source_periodic_confs
15 oldmask=$(umask)
16 umask 066
17 case "$monthly_accounting_enable" in
18 [Yy][Ee][Ss])
19 W=/var/log/wtmp
20 rc=0
21 remove=NO
22 if [ ! -f $W.0 ]
23 then
24 if [ -f $W.0.gz ]
25 then
26 remove=YES
27 zcat $W.0.gz > $W.0 || rc=1
28 elif [ -f $W.0.bz2 ]
29 then
30 remove=YES
31 bzcat $W.0.bz2 > $W.0 || rc=1
32 else
33 echo '$monthly_accounting_enable is set but' \
34 "$W.0 doesn't exist"
35 rc=2
38 if [ $rc -eq 0 ]
39 then
40 echo ""
41 echo "Doing login accounting:"
43 rc=$(ac -p -w $W.0 | sort -nr +1 | tee /dev/stderr | wc -l)
44 [ $rc -gt 0 ] && rc=1
46 [ $remove = YES ] && rm -f $W.0;;
48 *) rc=0;;
49 esac
51 umask $oldmask
52 exit $rc