e-smith-email/root/etc/e-smith/events/actions/fetchmail-migrate-fetchids

14 lines
415 B
Plaintext
Raw Permalink Normal View History

#!/usr/bin/perl
my $original_file = "/run/lock/fetchmail/.fetchids";
my $new_file = "/var/lib/fetchmail/.fetchids";
exit 0 if ( -f $new_file ) ;
exit 0 unless ( -f $original_file ) ;
while ( -f "/run/lock/fetchmail/fetchmail.pid" ) {
print "waiting for fetchmail to finish";
sleep 10;
}
system("/usr/bin/mv $original_file $new_file") == 0 or warn "The move $original_file to $new_file operation failed: $!";