in reply to Finding a string within a string
Zenn{...} foreach(@fsystem){ $fs=$_; print "Backup do $mountpoint{$fs} ($fs)\n"; open (FS,"/sbin/dump $param \/dev/$mountpoint{$fs} 2>&1 |"); push(@messages,("\nBackup de /dev/$mountpoint{$fs} ($fs)\n\n\n +")); while($linha=<FS>){ push(@messages,$linha); if ($linha=~ /DUMP IS DONE/){ print color 'green'; } if ($linha=~/error/)&&($linha=~/ERROR/)&&($linha=~/Error/){ print color 'red'; } print $linha; print color 'reset'; } close(FS); } {...} sub EnviaMail(){ $smtp = Net::SMTP->new('256.256.256.256'); $smtp->mail($sender); $smtp->to($resp); $smtp->data(); $smtp->datasend("To: $resp\n"); $smtp->datasend("From: \"Backup $localhost\" \<$sender>\n"); $smtp->datasend("Subject: Backup $localhost\n"); $smtp->datasend("\n"); foreach $linha (@messages) { $smtp->datasend($linha); } $smtp->dataend(); $smtp->quit; }
|
|---|