From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from betty.cs.widener.edu ([147.31.254.25]) by hawkwind.utcs.toronto.edu with SMTP id <2717>; Wed, 17 Jun 1992 11:29:19 -0400 Received: by betty.cs.widener.edu id AA07486 (5.65c/Widener-4.1 for rc mailing list ); Wed, 17 Jun 1992 11:01:10 -0400 Date: Wed, 17 Jun 1992 11:01:10 -0400 From: Brendan Kehoe Message-Id: <199206171501.AA07486@betty.cs.widener.edu> To: rc mailing list Subject: a quick hack Reply-To: brendan@cs.widener.edu I just threw this together, and thought it might be useful to others. It's the equivalent of /usr/lib/newsyslog, but adds a little more power and pep to it. Comments on style welcome. -- #!/bin/rc # Rotate the logs like /usr/lib/newsyslog, but $compress 'em. (The times # I actually check the old logs are one in a googleplex.) If you'd rather # not compress them, just change compress to `true'. logs=(/var/adm/messages /var/log/syslog) compress=freeze ; ext=F fn rotate { file=$1 ; shift while (! ~ $#* 1) { { ~ ($file.$2^*) $file.$2^'*' || { mv -f $file.^($2 $1)^.$ext || { mv -f $file^(.$2 .$1) && $compress $file.$1 } # we could do: eval ('mv -f $file.$2 ' '&& $compress ')^$file.1 }} >[2] /dev/null shift } } umask 22 # create the new log with mode 644 for (log in $logs) { test -s $log && { rotate $log 7 6 5 4 3 2 1 0 mv -f $file $file.0 && $compress $file.0 > $log } } exit 0 -- Brendan Kehoe, Sun Network Manager brendan@cs.widener.edu Widener University Chester, PA In action-oriented shows, TV cops fire their guns in almost every episode; in Chicago, the average police officer fires a gun once every 27 years.