#!/usr/local/bin/perl # backup.cgi # Run a filesystem backup, either in the background or foreground (and show # the results) require './fsdump-lib.pl'; &ReadParse(); $dump = &get_dump($in{'id'}); $dump->{'id'} || &error($text{'backup_egone'}); &can_edit_dir($dump) || &error($text{'backup_ecannot'}); if ($config{'run_mode'}) { # Background &ui_print_header(undef, $text{'backup_title'}, ""); print "
$text{'backup_bg'}
\n"; &clean_environment(); &system_logged("$cron_cmd ".quotemeta($dump->{'id'}). " >/dev/null 2>&1 {'id'}.notape"; unlink($nfile); &create_wrappers(); print "",&text('backup_desc', "".&html_escape($dump->{'dir'})."", &dump_dest($dump)),"
\n"; print "
";
$bok = &execute_before($dump, STDOUT, 1);
if (!$bok) {
# Before command failed
print "\n";
print "$text{'backup_beforefailed'}\n"; } else { # Do the dump $ok = &execute_dump($dump, STDOUT, 1, 0); $bok = &execute_after($dump, STDOUT, 1); print "\n"; if (!$bok) { print "$text{'backup_afterfailed'}
\n"; } elsif ($ok) { # Worked .. but verify if asked if ($dump->{'reverify'}) { print "$text{'backup_reverify'}
\n"; print "
"; $ok = &verify_dump($dump, STDOUT, 1, 0); print ""; } if ($ok) { print "$text{'backup_done'}