1#!/bin/mksh 2# $MirSecuCron$ 3# $MirOS: src/etc/monthly,v 1.21 2009/08/15 17:30:44 tg Exp $ 4# $OpenBSD: monthly,v 1.5 1998/02/02 23:08:57 millert Exp $ 5 6umask 022 7export TZ=UTC PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/mpkg/bin 8cd / 9 10print RUNTIME=$(date +%J) 11print 12 13if [ -f /etc/monthly.local ];then 14 print "Running monthly.local:" 15 . /etc/monthly.local 16else 17 print "Nothing to do!" 18fi 19 20if [[ -e /var/log/wtmp ]]; then 21 print 22 print Doing login accounting for the time since last run 23 print and rotating login accounting log file: 24 ac -p | sort -nr +1 25 for f in /var/log/wtmp.*.gz; do 26 [[ -s $f ]] || continue 27 gzip -df "$f" 28 done 29 install -c -o root -g wheel -m 640 /dev/null /var/log/wtmp.new 30 [[ -e /var/log/wtmp.0 ]] && mv -f /var/log/wtmp.0 /var/log/wtmp.1 31 mv -f /var/log/wtmp /var/log/wtmp.0 32 mv -f /var/log/wtmp.new /var/log/wtmp 33fi 34