Changeset 816


Ignore:
Timestamp:
03/03/10 23:27:06 (14 years ago)
Author:
nanardon
Message:
  • ensure child process get riped
Location:
LATMOS-Accounts
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • LATMOS-Accounts/Makefile.PL

    r813 r816  
    55WriteMakefile( 
    66    NAME              => 'LATMOS::Accounts', 
    7     VERSION           => '0.0.18', # finds $VERSION 
     7    VERSION           => '0.0.19', # finds $VERSION 
    88    PREREQ_PM         => { 
    99        'Net::LDAP' => undef, 
  • LATMOS-Accounts/bin/la-sync-manager

    r694 r816  
    1919my $pidfile = undef; 
    2020 
    21 $SIG{'HUP'} = sub { 
    22     $needsync = 1; 
    23     la_log LA_NOTICE, "SigHup received, synchronise now"; 
    24 }; 
    25  
    2621la_set_log( 
    2722    syslog => [], 
     
    4338    } 
    4439} 
    45  
    46 $SIG{INT} = sub { 
    47     unlink($pidfile) if ($pidfile); 
    48     exit 0; 
    49 }; 
    5040 
    5141if ($pidfile) { 
     
    8676} 
    8777 
     78$SIG{INT} = sub { 
     79    unlink($pidfile) if ($pidfile); 
     80    exit 0; 
     81}; 
     82 
     83$SIG{'HUP'} = sub { 
     84    $needsync = 1; 
     85    la_log LA_NOTICE, "SigHup received, synchronise now"; 
     86}; 
     87 
    8888while (1) { 
    8989    if ($needsync) { 
     
    9393            $SIG{INT} = undef; 
    9494            exit sync(); 
    95         } else { 
    96             while(waitpid($pid, 0) <= 0) {} 
     95        } 
     96        my $retpid; 
     97        while(($retpid = waitpid(-1, 0)) <= 0) {} 
     98        if ($retpid) { 
    9799            my $res = $? << 8; 
    98100            if ($res) { 
    99                la_log LA_ERR, "Sync process exit with $res"; 
    100            }  
     101                la_log LA_ERR, "Sync process exit with $res"; 
     102            }  
     103            next; 
    101104        } 
    102         next; 
    103105    } 
    104106 
Note: See TracChangeset for help on using the changeset viewer.