gri6507 has asked for the wisdom of the Perl Monks concerning the following question:
I have a program that is started when a user logs into the system and stays alive (hopefully) until the user exits. This program occasionally logs some events to $logfile. Recently, I received a request from my boss to make sure that this logfile does not exceed some predefined file size, which, for the sake of this discussion will be 100 lines of the log file. In other words, I need a way to do `tail -100 $logfile > $logfile.tmp; mv $logfile.tmp $logfile` from inside my script. Is there a propper perlish way to do that?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: perlish way to 'tail -100 $logfile'
by talexb (Chancellor) on Dec 09, 2005 at 17:45 UTC | |
|
Re: perlish way to 'tail -100 $logfile'
by holli (Abbot) on Dec 09, 2005 at 17:44 UTC | |
|
Re: perlish way to 'tail -100 $logfile'
by isotope (Deacon) on Dec 09, 2005 at 18:04 UTC | |
by gri6507 (Deacon) on Dec 09, 2005 at 19:12 UTC | |
|
Re: perlish way to 'tail -100 $logfile'
by ptum (Priest) on Dec 09, 2005 at 17:45 UTC | |
|
Re: perlish way to 'tail -100 $logfile'
by Roy Johnson (Monsignor) on Dec 09, 2005 at 18:02 UTC |