#!/bin/mksh # $MirSecuCron$ # $MirOS: src/etc/monthly,v 1.21 2009/08/15 17:30:44 tg Exp $ # $OpenBSD: monthly,v 1.5 1998/02/02 23:08:57 millert Exp $ umask 022 export TZ=UTC PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/mpkg/bin cd / print RUNTIME=$(date +%J) print if [ -f /etc/monthly.local ];then print "Running monthly.local:" . /etc/monthly.local else print "Nothing to do!" fi if [[ -e /var/log/wtmp ]]; then print print Doing login accounting for the time since last run print and rotating login accounting log file: ac -p | sort -nr +1 for f in /var/log/wtmp.*.gz; do [[ -s $f ]] || continue gzip -df "$f" done install -c -o root -g wheel -m 640 /dev/null /var/log/wtmp.new [[ -e /var/log/wtmp.0 ]] && mv -f /var/log/wtmp.0 /var/log/wtmp.1 mv -f /var/log/wtmp /var/log/wtmp.0 mv -f /var/log/wtmp.new /var/log/wtmp fi