Leser: 2
5 Einträge, 1 Seite |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
#!/usr/bin/perl use strict; use warnings; use MIME::Lite; use File::Copy qw(copy); my $dir = '/verzeichnis/'; my $file = $dir . 'tttt.txt'; if( -e $file ){ my ($d,$m,$y) = (localtime time)[3..5]; my $date = sprintf "%02d%02d%04d", $d,$m+1,$y+1900; my $new = 'tttt' . $date . '.bak'; copy $file, $new; } else{ my $mail = MIME::Lite->new( From => 'any_address@domain.example', To => 'chef@domain.example', Subject => 'tttt.txt nicht da', Data => 'Gude Chef, tttt.txt ist nicht da!', ); $mail->send; }
1 2 3 4 5 6 7 8 9
# [...] if( -e $file ){ my ($d,$m,$y) = (localtime time)[3..5]; my $date = sprintf "%02d%02d%04d", $d,$m+1,$y+1900; my $new = 'tttt' . $date . '.bak'; copy $file, $new; unlink $file if -e $new; } # [...]
5 Einträge, 1 Seite |