I believe the previous two patches are incorrect, because the fields in
"sort +n" are numbered starting from zero, whereas "sort -k n" numbers
the fields from 1.  So "sort +1" is equivalent to "sort -k2".

The attached patch to /etc/cron.monthly/acct allows for this difference,
and prevents the monthly email about this deprecated syntax.

Nick
--- /etc/cron.monthly/acct.orig 2006-06-03 16:54:40.000000000 +0100
+++ /etc/cron.monthly/acct      2006-10-05 08:56:35.000000000 +0100
@@ -30,7 +30,7 @@
            gunzip -c /var/log/wtmp.1.gz > $WTMP
        fi
 
-       ac -f $WTMP /var/log/wtmp.1 -p | sort -nr +1 >> /var/log/wtmp.report
+       ac -f $WTMP /var/log/wtmp.1 -p | sort -nr -k2 >> /var/log/wtmp.report
        echo >> /var/log/wtmp.report
        last -f $WTMP >> /var/log/wtmp.report
 
@@ -40,7 +40,7 @@
            rm -f $WTMP
        fi
     else
-       ac -p | sort -nr +1 >> /var/log/wtmp.report
+       ac -p | sort -nr -k2 >> /var/log/wtmp.report
        echo >> /var/log/wtmp.report
        last >> /var/log/wtmp.report
     fi

Reply via email to