From: Brendan Kehoe <brendan@cs.widener.edu>
To: rc mailing list <rc@hawkwind.utcs.toronto.edu>
Subject: a quick hack
Date: Wed, 17 Jun 1992 11:01:10 -0400 [thread overview]
Message-ID: <199206171501.AA07486@betty.cs.widener.edu> (raw)
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.
reply other threads:[~1992-06-17 15:29 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=199206171501.AA07486@betty.cs.widener.edu \
--to=brendan@cs.widener.edu \
--cc=rc@hawkwind.utcs.toronto.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).