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
In reply to Re: Simple Log Rotate Problem
by meetraz
in thread Simple Log Rotate Problem
by monger
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |