Log rotation

bpmedley at 4321.tv bpmedley at 4321.tv
Fri Aug 3 23:35:12 EDT 2001


On 3 Aug 2001, Seth Gordon wrote:

> Hmm, I'll have to look at that Logfile::Rotate module on Monday.  Thanks.
>
> If anyone has entirely too much free time over the weekend, they can
> explain to me why this script doesn't copy its input into the log file
> (as I expected), but just seems to write a stream of blank lines:
>
> #!/util/bin/bash
> trap 'cp log.recent log.`date -I` ' 1 # SIGHUP
> trap 'exit 0' 13 # SIGPIPE
> while [ read $line ]; do
>     echo "$line" >>log.recent
> done
>
#! /bin/sh

trap 'cp log.recent log.`date -I` ' 1 # SIGHUP
trap 'exit 0' 13 # SIGPIPE
while { read line; }; do                 # worked for me
# while ( read line ); do                # didn't work for me
    echo "$line" >> log.recent
done

YMMV

~'`^`'~=-.,__,.-=~'`^`'~=-.,__,.-=~'`^`'~=-., \|/  (___)  \|/ _,.-=~'`^`
                          Brian Medley         @~./'O o`\.~@
"Knowledge is Power" brian.medley at verizon.net /__( \___/ )__\  *PPPFFBT!*
  -- Francis Bacon                               `\__`U_/'
 _,.-=~'`^`'~=-.,__,.-=~'`^`'~=-.,__,.-=~'`^`'~= <____|'  ^^`'~=-.,__,.-=
~`'^`'~=-.,__,.-=~'`^`'~=-.,__,.-=~'`^`'~=-.,__,.-==--^'~=-.,__,.-=~'`^`

-
Subcription/unsubscription/info requests: send e-mail with
"subscribe", "unsubscribe", or "info" on the first line of the
message body to discuss-request at blu.org (Subject line is ignored).



More information about the Discuss mailing list