On Fri, 22 Mar 2002, TORRESANI, Roberto wrote:
> 1) begin backup: a perl script sends a trap to indicate that the backup is started
> 2) the main backup script does his work
> 3) end backup: at the end of the main backup script this is called to indicate that
>the backup is finished.
> A trap is sent to the mon server, with appropriate return code and a summary of the
>backup log.
wrap this up into a regular monitor script which returns success if the
backup completes in time, and failure if it doesn't.
#!/usr/bin/perl
use English;
eval
{
local $SIG{ALRM} = sub { die "Timeout Alarm" };
alarm 300;
# run the backup
system ("the-backup");
alarm 0;
};
if ($EVAL_ERROR and ($EVAL_ERROR =~ /^Timeout Alarm/))
{
print "fail\n";
exit 1;
}
else
{
print "success\n";
exit 0;
}