--- lib/PXElator/httpd.pm 2009/07/31 14:42:45 77 +++ lib/PXElator/httpd.pm 2009/07/31 18:48:29 91 @@ -111,7 +111,9 @@ return qq|$daemon pid $pid started|; } elsif ( defined $pid ) { # child - my $eval = $daemon . '::start(' . ( @_ ? dump(@_) : '' ) . ')'; + my $invoke = 'start'; + $invoke = $1 if $daemon =~ s{/(.+)}{}; + my $eval = $daemon . '::' . $invoke . '(' . ( @_ ? dump(@_) : '' ) . ')'; warn "eval $eval"; eval $eval; warn "can't start $daemon: $@" if $@; @@ -147,38 +149,55 @@ my $debug_proc; - warn 'pids: ', dump( $pids ); - foreach my $name ( keys %$pids ) { + warn 'pids: ', dump( $pids ) if $debug; + foreach my $name ( sort keys %$pids ) { my $pid = $pids->{$name} || next; - my $html = qq|$pid|; + my $html = qq|$pid|; - if ( $debug ) { - $html .= qq| ?|; + my $proc = "/proc/$pid/status"; - my $proc = "/proc/$pid/status"; - $debug_proc - .= qq|$proc
|
-					.  read_file($proc)
-					.  qq|
| - if -e $proc; + if ( -e $proc ) { + if ( $debug ) { + $html .= qq| ?|; + + $debug_proc + .= qq|$proc
|
+						.  read_file($proc)
+						.  qq|
| + ; + } + + if ( $name->can('start_fork') ) { + $html .= qq| $_| foreach $name->start_fork; + } + + if ( $name->can('actions') ) { + $html .= qq| $_| foreach $name->actions; + } } push @rows, ( $name => $html ); } - warn 'static_pids: ', dump( $static_pids ); + my $below_table = ''; + + warn 'static_pids: ', dump( $static_pids ) if $debug; foreach my $pid ( keys %$static_pids ) { my $path = $static_pids->{$pid}; if ( -d "/proc/$pid" ) { push @rows, ( $path => qq|$pid| ); + } elsif ( $param->{clean_completed_downloads} ) { + delete $static_pids->{$pid} } else { push @rows, ( $path => "$pid competed" ); + $below_table = qq|clean completed downloads|; } } print $client $ok , html::table( 2, @rows ) + , $below_table , html::tabs( log::mac_changes ) , $debug_proc ; @@ -188,11 +207,14 @@ warn $@ if $@; print $client $redirect, qq|$1 = $2
Location: $url|; server::debug( $debug ) if $1 eq 'debug'; - } elsif ( $path =~ m{^/(screen|kvm)} ) { + } elsif ( $path =~ m{^/start_stop/((?:screen|kvm).*)} ) { # XXX we don't want to stop all classes print $client $redirect, start_stop($1); + } elsif ( $path =~ m{^/action/([^/]+)/(.+)} ) { + $1->$2(); + print $client $redirect; } elsif ( $path =~ m{^/kill/static/(\d+)} ) { print $client $redirect; - kill 9, $1 && warn "killed $1"; + kill 1, $1 || kill 9, $2 && warn "killed $1"; } elsif ( $path eq '/exit' ) { # DESTROY; exit 0;