/[pxelator]/lib/PXElator/httpd.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /lib/PXElator/httpd.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 157 by dpavlin, Wed Aug 5 23:22:17 2009 UTC revision 158 by dpavlin, Thu Aug 6 15:36:13 2009 UTC
# Line 102  sub static { Line 102  sub static {
102    
103  use boolean;  use boolean;
104    
 use screen;  
105  use kvm;  use kvm;
106    
107  $SIG{CHLD} = 'IGNORE';  $SIG{CHLD} = 'IGNORE';
# Line 130  sub start_stop { Line 129  sub start_stop {
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 $!";
# Line 155  sub get_request { Line 160  sub get_request {
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                  );                  );
# Line 245  sub get_request { Line 246  sub get_request {
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();
# Line 288  sub start { Line 289  sub start {
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) {

Legend:
Removed from v.157  
changed lines
  Added in v.158

  ViewVC Help
Powered by ViewVC 1.1.26