/[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 181 by dpavlin, Sun Aug 9 19:00:52 2009 UTC revision 184 by dpavlin, Sun Aug 9 20:46:00 2009 UTC
# Line 113  $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 128  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 ) {

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

  ViewVC Help
Powered by ViewVC 1.1.26