3 # Run a filesystem backup, either in the background or foreground (and show
6 require './fsdump-lib.pl';
8 $dump = &get_dump($in{'id'});
9 $dump->{'id'} || &error($text{'backup_egone'});
10 &can_edit_dir($dump) || &error($text{'backup_ecannot'});
12 if ($config{'run_mode'}) {
14 &ui_print_header(undef, $text{'backup_title'}, "");
16 print "<p>$text{'backup_bg'}<p>\n";
18 &system_logged("$cron_cmd ".quotemeta($dump->{'id'}).
19 " >/dev/null 2>&1 </dev/null &");
21 &webmin_log("bgbackup", undef, undef, $dump);
25 &ui_print_unbuffered_header(undef, $text{'backup_title'}, "");
27 # Setup command to be called upon tape change (which is not
28 # supported in this mode)
29 $nfile = "$module_config_directory/$dump->{'id'}.notape";
33 print "<b>",&text('backup_desc',
34 "<tt>".&html_escape($dump->{'dir'})."</tt>",
35 &dump_dest($dump)),"</b><p>\n";
37 $bok = &execute_before($dump, STDOUT, 1);
38 if (!$bok && !$dump->{'beforefok'}) {
39 # Before command failed
41 print "<b>$text{'backup_beforefailed'}</b><p>\n";
46 $ok = &execute_dump($dump, STDOUT, 1, 0, $now);
49 print "<b>$text{'backup_afterfailed'}</b><p>\n";
52 # Worked .. but verify if asked
53 if ($dump->{'reverify'}) {
54 print "<b>$text{'backup_reverify'}</b><p>\n";
56 $ok = &verify_dump($dump, STDOUT, 1, 0, $now);
60 print "<b>$text{'backup_done'}</b><br>\n";
63 print "<b>$text{'backup_noverify'}</b><br>\n";
68 print "<b>$text{'backup_notape'}</b><br>\n";
71 print "<b>$text{'backup_failed'}</b><br>\n";
75 # Execute the post-backup command, if any
78 $bok = &execute_after($dump, STDOUT, 1);
83 delete($dump->{'pass'});
84 &webmin_log("backup", undef, undef, $dump);
87 &ui_print_footer($access{'edit'} ? ( "edit_dump.cgi?id=$in{'id'}",
88 $text{'edit_return'} ) : ( ),
89 "", $text{'index_return'});