in reply to Simple Log Rotate Problem
update: it looks like you are trying to move the $out file to the $old file, but you're not deleting the $old file first. Then you are trying to unlink() the $out file, but if the mv() succeeded, it would fail anyway.
Try this:
my $dir = "H:/vpn/"; my $out = "H:/vpn/vpnwarn.out"; my $old = "H:/vpn/vpnwarn.old"; if (-e $old) { unlink($old) || die ("Could not unlink: $!"); } if (-e $out) { mv ($out, $old) || die ("Could not mv: $!"); } # create and write new $out here
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Simple Log Rotate Problem
by monger (Friar) on Nov 13, 2003 at 21:57 UTC | |
by meetraz (Hermit) on Nov 13, 2003 at 22:04 UTC | |
by monger (Friar) on Nov 14, 2003 at 14:14 UTC |