97 |
warn "start_stop $daemon $pid pids: ",dump( $pids ); |
warn "start_stop $daemon $pid pids: ",dump( $pids ); |
98 |
|
|
99 |
if ( $pid =~ m{^\d+$} ) { |
if ( $pid =~ m{^\d+$} ) { |
100 |
warn "kill 9 $pid"; |
my $pstree = `pstree -p $pid`; |
101 |
kill 9, $pid; |
my @pids = $pstree =~ m{\((\d+)\)}g; |
102 |
|
warn "pstree $pstree pids ",dump( @pids ); |
103 |
|
kill 1, $_ foreach reverse @pids; |
104 |
$pids->{$daemon} = 'stopped'; |
$pids->{$daemon} = 'stopped'; |
105 |
return qq|$daemon pid $pid stopped|; |
return qq|$daemon pid $pid stopped|; |
106 |
} else { |
} else { |
145 |
'debug', qq|<a href=/our/debug/| . boolean::toggle($debug) . qq|>$debug</a>|, |
'debug', qq|<a href=/our/debug/| . boolean::toggle($debug) . qq|>$debug</a>|, |
146 |
); |
); |
147 |
|
|
148 |
warn 'pids: ', dump( $pids ); |
my $debug_proc; |
149 |
|
|
150 |
|
warn 'pids: ', dump( $pids ) if $debug; |
151 |
foreach my $name ( keys %$pids ) { |
foreach my $name ( keys %$pids ) { |
152 |
my $pid = $pids->{$name} || next; |
my $pid = $pids->{$name} || next; |
|
my $proc = "/proc/$pid/status"; |
|
153 |
|
|
154 |
my $html = qq|<a href=/$name>$pid</a>|; |
my $html = qq|<a href=/$name>$pid</a>|; |
155 |
$html .= qq|<pre style="font-size: 10%">| |
|
156 |
. ( $debug && -e $proc ? read_file($proc) : '' ) |
if ( $debug ) { |
157 |
. qq|</pre>| if $debug; |
$html .= qq| <a name=$pid href=#proc-$pid>?</a>|; |
158 |
|
|
159 |
|
my $proc = "/proc/$pid/status"; |
160 |
|
$debug_proc |
161 |
|
.= qq|<a name=proc-$pid href=#$pid>$proc</a><pre style="font-size: 10%">| |
162 |
|
. read_file($proc) |
163 |
|
. qq|</pre>| |
164 |
|
if -e $proc; |
165 |
|
} |
166 |
|
|
167 |
push @rows, ( $name => $html ); |
push @rows, ( $name => $html ); |
168 |
} |
} |
169 |
|
|
170 |
warn 'static_pids: ', dump( $static_pids ); |
warn 'static_pids: ', dump( $static_pids ) if $debug; |
171 |
foreach my $pid ( keys %$static_pids ) { |
foreach my $pid ( keys %$static_pids ) { |
172 |
my $path = $static_pids->{$pid}; |
my $path = $static_pids->{$pid}; |
173 |
if ( -d "/proc/$pid" ) { |
if ( -d "/proc/$pid" ) { |
177 |
} |
} |
178 |
} |
} |
179 |
|
|
180 |
print $client $ok, html::table( 2, @rows ); |
print $client $ok |
181 |
|
, html::table( 2, @rows ) |
182 |
|
, html::tabs( log::mac_changes ) |
183 |
|
, $debug_proc |
184 |
|
; |
185 |
|
|
186 |
} elsif ( $path =~ m{^/our/(\w+)/(\S+)} ) { |
} elsif ( $path =~ m{^/our/(\w+)/(\S+)} ) { |
187 |
eval 'our $' . $1 . ' = ' . $2; |
eval 'our $' . $1 . ' = ' . $2; |