in reply to help with scp error codes
On my system, scp return an error code on error. ("DIAGNOSTICS: scp exits with 0 on success or >0 if an error occurred.") system returns and sets $? to a value that contains the exit code of the process it launched.
my $filetoget = "$f.\@FILEDOMAIN$i.$year-$mon-$mday"; my @cmd = ( '/usr/bin/scp', "$a:$LOGFILEDIR/$filetoget", "$filetoget.$a", ); my $rv = system(@cmd); if ($rv == -1) { print("Unable to execute scp: $!\n"); } elsif ($rv & 127) { printf("scp died with signal %d\n", ($rv & 127)); } elseif {$rv >> 8) { printf("scp exited with error %d\n", ($rv >> 8)); } else { print("scp was successful\n"); }
As for the email part, MIME::Lite should do the trick.
Update: Oops, was missing scp's 2nd arg.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: help with scp error codes
by tachyon-II (Chaplain) on Mar 16, 2008 at 09:21 UTC |