#!/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 ",&text('backup_desc', "".&html_escape($dump->{'dir'})."", &dump_dest($dump)),"

\n"; print "

";
	$bok = &execute_before($dump, STDOUT, 1);
	if (!$bok && !$dump->{'beforefok'}) {
		# Before command failed
		print "
\n"; print "$text{'backup_beforefailed'}

\n"; } else { # Do the dump $now = time(); $ok = &execute_dump($dump, STDOUT, 1, 0, $now); 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, $now);
				print "
"; } if ($ok) { print "$text{'backup_done'}
\n"; } else { print "$text{'backup_noverify'}
\n"; } } else { if (-r $nfile) { print "$text{'backup_notape'}
\n"; } else { print "$text{'backup_failed'}
\n"; } } # Execute the post-backup command, if any if ($ok) { print "
";
			$bok = &execute_after($dump, STDOUT, 1);
			print "
\n"; } } unlink($nfile); delete($dump->{'pass'}); &webmin_log("backup", undef, undef, $dump); } &ui_print_footer($access{'edit'} ? ( "edit_dump.cgi?id=$in{'id'}", $text{'edit_return'} ) : ( ), "", $text{'index_return'});