1993-03-21 12:45:37 +03:00
|
|
|
#!/bin/sh -
|
|
|
|
#
|
2004-04-09 21:35:21 +04:00
|
|
|
# $NetBSD: monthly,v 1.10 2004/04/09 17:35:21 kim Exp $
|
1997-02-15 13:02:07 +03:00
|
|
|
# from: @(#)monthly 8.1 (Berkeley) 6/9/93
|
1993-03-21 12:45:37 +03:00
|
|
|
#
|
|
|
|
|
1998-09-15 09:06:30 +04:00
|
|
|
export PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
1997-01-05 14:21:09 +03:00
|
|
|
umask 077
|
|
|
|
|
|
|
|
if [ -s /etc/monthly.conf ]; then
|
|
|
|
. /etc/monthly.conf
|
|
|
|
fi
|
|
|
|
|
1998-09-15 09:06:30 +04:00
|
|
|
host=`hostname`
|
|
|
|
date=`date`
|
2004-04-02 17:13:47 +04:00
|
|
|
rcvar_manpage='monthly.conf(5)'
|
1998-09-15 09:06:30 +04:00
|
|
|
|
|
|
|
echo "To: ${MAILTO:-root}"
|
|
|
|
echo "Subject: $host monthly output for $date"
|
|
|
|
echo ""
|
|
|
|
|
2004-04-09 21:35:21 +04:00
|
|
|
MONTHLYDIR=`mktemp -d /tmp/_monthly.XXXXXX` || exit 1
|
|
|
|
|
|
|
|
trap "/bin/rm -rf $MONTHLYDIR ; exit 0" EXIT INT QUIT PIPE
|
|
|
|
|
|
|
|
if ! cd "$MONTHLYDIR"; then
|
|
|
|
echo "Can not cd to $MONTHLYDIR".
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
TMP=monthly.$$
|
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
# echo ""
|
|
|
|
# echo "Doing login accounting:"
|
|
|
|
# ac -p | sort -nr +1
|
|
|
|
|
2000-01-10 20:03:49 +03:00
|
|
|
if [ -f /etc/monthly.local ]; then
|
2004-04-09 21:35:21 +04:00
|
|
|
. /etc/monthly.local > $TMP 2>&1
|
|
|
|
if [ -s $TMP ] ; then
|
|
|
|
printf "\nRunning /etc/monthly.local:\n"
|
|
|
|
cat $TMP
|
|
|
|
fi
|
|
|
|
rm -f $TMP
|
2000-01-10 20:03:49 +03:00
|
|
|
fi
|