aboutsummaryrefslogtreecommitdiff
path: root/etc/periodic/monthly/200.accounting
blob: f808bbf8a8535b62f19267321b9700c66232f7a4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh -
#
# $FreeBSD$
#

# If there is a global system configuration file, suck it in.
#
if [ -r /etc/defaults/periodic.conf ]
then
    . /etc/defaults/periodic.conf
    source_periodic_confs
fi

case "$monthly_accounting_enable" in
    [Yy][Ee][Ss])
	W=/var/log/wtmp
	if [ ! -f $W.0 ]
	then
	    echo '$monthly_accounting_enable is set but' \
		"$W.0 doesn't exist"
	    rc=2
	else
	    echo ""
	    echo "Doing login accounting:"

	    rc=$(ac -p -w $W.0 | sort -nr +1 | tee /dev/stderr | wc -l)
	    [ $rc -gt 0 ] && rc=1
	fi;;

    *)  rc=0;;
esac

exit $rc