102 |
|
|
103 |
use boolean; |
use boolean; |
104 |
|
|
|
use screen; |
|
105 |
use kvm; |
use kvm; |
106 |
|
|
107 |
$SIG{CHLD} = 'IGNORE'; |
$SIG{CHLD} = 'IGNORE'; |
129 |
# child |
# child |
130 |
my $invoke = 'start'; |
my $invoke = 'start'; |
131 |
$invoke = $1 if $daemon =~ s{/(.+)}{}; |
$invoke = $1 if $daemon =~ s{/(.+)}{}; |
132 |
my $eval = $daemon . '::' . $invoke . '(' . ( @_ ? dump(@_) : '' ) . ')'; |
if ( $daemon =~ m{dhcpd|tftpd|dnsd} ) { |
133 |
warn "eval $eval"; |
my $exec = "perl -I$server::base_dir/lib -I$server::base_dir/lib/PXElator -M$daemon -e ${daemon}::${invoke}"; |
134 |
eval $eval; |
warn "exec $exec"; |
135 |
warn "can't start $daemon: $@" if $@; |
exec "xterm -T $daemon -n $daemon -e $exec"; |
136 |
|
} else { |
137 |
|
my $eval = $daemon . '::' . $invoke . '(' . ( @_ ? dump(@_) : '' ) . ')'; |
138 |
|
warn "eval $eval"; |
139 |
|
eval $eval; |
140 |
|
warn "can't start $daemon: $@" if $@; |
141 |
|
} |
142 |
exit; |
exit; |
143 |
} else { |
} else { |
144 |
die "fork error $!"; |
die "fork error $!"; |
160 |
warn "static $found" if $debug; |
warn "static $found" if $debug; |
161 |
} elsif ( $path eq '/' ) { |
} elsif ( $path eq '/' ) { |
162 |
|
|
|
my $screen = $pids->{screen} ? qq|stop <tt>$pids->{screen}</tt>| : 'start'; |
|
|
my $kvm = $pids->{kvm} ? qq|stop <tt>$pids->{kvm}</tt>| : |
|
|
$pids->{screen} ? qq|start| : qq|start screen first|; |
|
|
|
|
163 |
my @rows = ( |
my @rows = ( |
164 |
'debug', qq|<a href=/our/debug/| . boolean::toggle($debug) . qq|>$debug</a>|, |
'debug', qq|<a href=/our/debug/| . boolean::toggle($debug) . qq|>$debug</a>|, |
165 |
); |
); |
246 |
warn $@ if $@; |
warn $@ if $@; |
247 |
print $client $redirect, qq|<big>$1 = $2</big><br>Location: <a href="$url">$url</a>|; |
print $client $redirect, qq|<big>$1 = $2</big><br>Location: <a href="$url">$url</a>|; |
248 |
server::debug( $debug ) if $1 eq 'debug'; |
server::debug( $debug ) if $1 eq 'debug'; |
249 |
} elsif ( $path =~ m{^/start_stop/((?:screen|kvm).*)} ) { # XXX we don't want to stop all classes |
} elsif ( $path =~ m{^/start_stop/(\S+)} ) { |
250 |
print $client $redirect, start_stop($1); |
print $client $redirect, start_stop($1); |
251 |
} elsif ( $path =~ m{^/action/([^/]+)/(.+)} ) { |
} elsif ( $path =~ m{^/action/([^/]+)/(.+)} ) { |
252 |
$1->$2(); |
$1->$2(); |
289 |
print "url $url\n"; |
print "url $url\n"; |
290 |
|
|
291 |
start_stop 'browser', $url; |
start_stop 'browser', $url; |
292 |
start_stop 'screen'; |
start_stop 'dhcpd'; |
293 |
|
start_stop 'tftpd'; |
294 |
|
start_stop 'dnsd'; |
295 |
start_stop 'kvm'; |
start_stop 'kvm'; |
296 |
|
|
297 |
while (1) { |
while (1) { |