Kill all dump processes

This commit is contained in:
Jamie Cameron
2009-04-27 21:34:44 +00:00
parent 6c9086a14e
commit ea33e4a7d0
4 changed files with 24 additions and 2 deletions
+2
View File
@@ -37,3 +37,5 @@ Added checkboxes to control if failure of the pre and post-backup commands cause
Prevent non-level-0 backups and updating of the /etc/dumpdates file for backups of directories that are not filesystem mount points, as this isn't supported by the <tt>dump</tt> command.
---- Changes since 1.440 ----
Fixed a bug that prevented backups of directories with spaces in their names from working properly on Linux.
---- Changes since 1.480 ----
When terminating a running backup, all sub-processes such as tar and dump commands are killed too.
+19 -1
View File
@@ -10,11 +10,29 @@ require './fsdump-lib.pl';
@procs = &proc::list_processes();
@running = &running_dumps(\@procs);
# Find the job
($job) = grep { $_->{'id'} eq $in{'id'} &&
$_->{'pid'} == $in{'pid'} } @running;
$job || &error($text{'kill_egone'});
&can_edit_dir($job) || &error($text{'kill_ecannot'});
kill('TERM', $job->{'pid'});
# Find all sub-processes
@killprocs = ( $job->{'pid'}, &find_subprocesses($job->{'pid'}) );
&kill_logged('TERM', @killprocs);
sleep(1);
&kill_logged('KILL', @killprocs);
&webmin_log("kill", undef, $job->{'id'}, $job);
&redirect("");
sub find_subprocesses
{
local ($pid) = @_;
local @rv;
foreach my $p (@procs) {
if ($p->{'ppid'} && $p->{'ppid'} eq $pid) {
push(@rv, $p->{'pid'}, &find_subprocesses($p->{'pid'}));
}
}
return @rv;
}
+1
View File
@@ -195,6 +195,7 @@ log_delete=Deleted backup config for $1
log_backup=Backed up $1 to $2
log_bgbackup=Started backup of $1 to $2
log_restore=Restored backup from $1
log_kill=Terminated backup for $1
kill_err=Failed to terminate backup
kill_egone=No longer running!
+2 -1
View File
@@ -8,7 +8,8 @@ do 'fsdump-lib.pl';
sub parse_webmin_log
{
local ($user, $script, $action, $type, $object, $p) = @_;
if ($action eq 'create' || $action eq 'modify' || $action eq 'delete') {
if ($action eq 'create' || $action eq 'modify' ||
$action eq 'delete' || $action eq 'kill') {
return &text("log_$action", "<tt>".&html_escape($p->{'dir'})."</tt>");
}
elsif ($action eq 'backup' || $action eq 'bgbackup') {