/[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 173 by dpavlin, Thu Aug 6 22:29:58 2009 UTC revision 184 by dpavlin, Sun Aug 9 20:46:00 2009 UTC
# Line 53  use config; Line 53  use config;
53  use client;  use client;
54  use log;  use log;
55  use x11;  use x11;
56    use amt;
57    
58  sub static {  sub static {
59          my ($client,$path) = @_;          my ($client,$path) = @_;
# Line 112  $SIG{CHLD} = 'IGNORE'; Line 113  $SIG{CHLD} = 'IGNORE';
113    
114  sub start_stop {  sub start_stop {
115          my $daemon = shift;          my $daemon = shift;
         my $pid = $pids->{$daemon} || 'not started';  
116    
117            my $pid = $pids->{$daemon};
118            my $pid_path = "$server::conf/$daemon.pid";
119    
120            if ( ! $pid && -e $pid_path ) {
121                    my $p = read_file $pid_path;
122                    if ( kill 0, $p ) {
123                            warn "adopted $daemon $p\n";
124                            return $pids->{$daemon} = $p;
125                    } else {
126                            warn "old $daemon $p not running";
127                            unlink $pid_path;
128                    }
129            }
130    
131            $pid ||= 'not started';
132          warn "start_stop $daemon $pid\n";          warn "start_stop $daemon $pid\n";
133    
134          if ( $pid =~ m{^\d+$} ) {          if ( $pid =~ m{^\d+$} ) {
# Line 127  sub start_stop { Line 142  sub start_stop {
142                  if ( $pid = fork ) {                  if ( $pid = fork ) {
143                          # parent                          # parent
144                          $pids->{$daemon} = $pid;                          $pids->{$daemon} = $pid;
145                            write_file $pid_path, $pid;
146                          warn "forked $daemon $pid\n";                          warn "forked $daemon $pid\n";
147                          return qq|$daemon pid $pid started|;                          return qq|$daemon pid $pid started|;
148                  } elsif ( defined $pid ) {                  } elsif ( defined $pid ) {
# Line 248  sub get_request { Line 264  sub get_request {
264                                  , config::for_ip( $ip )                                  , config::for_ip( $ip )
265                                  , qq|</pre>|                                  , qq|</pre>|
266                                  ;                                  ;
267    
268                            if ( my $amt = client::conf( $ip, 'amt' ) ) {
269                                    print $client amt::info( $amt );
270                            }
271                  } else {                  } else {
272                          print $client $ok                          print $client $ok
273                                  , qq|<h2>Clients on $server::ip</h2>|                                  , qq|<h2>Clients on $server::ip</h2>|
# Line 302  sub start { Line 322  sub start {
322          start_stop 'dhcpd';          start_stop 'dhcpd';
323          start_stop 'tftpd';          start_stop 'tftpd';
324          start_stop 'dnsd';          start_stop 'dnsd';
325          start_stop 'kvm';          start_stop 'kvm' unless $ENV{DEV}; # skip kvm statup when running on real device
326    
327          while (1) {          while (1) {
328                  my $client = $server->accept() || next; # ALARM trickle us                  my $client = $server->accept() || next; # ALARM trickle us

Legend:
Removed from v.173  
changed lines
  Added in v.184

  ViewVC Help
Powered by ViewVC 1.1.26