Changeset 11243

Show
Ignore:
Timestamp:
08/21/08 17:30:28 (5 months ago)
Author:
/C=ES/O=Warp Networks S.L./CN=ejhernandez@…
Message:

Fixing minor bugs on runnerd daemon. Logging is still not working refs #1103

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/remote-services/ebox/src/libexec/ebox-runnerd

    r11240 r11243  
    6262    POSIX::close($_) foreach (0 .. 64); 
    6363 
    64     open( STDIN, '/dev/null'); 
    65     open( STDOUT, '/dev/null'); 
    66     open( STDERR, '/dev/null'); 
     64    open( STDIN, '<', '/dev/null'); 
     65    open( STDOUT, '+>', '/dev/null'); 
     66    open( STDERR, '+>', '/dev/null'); 
    6767 
    6868} 
     
    138138my $incomingSub = sub { 
    139139    my ($event) = @_; 
    140     EBox::debug("New stuff: $event->{name}"); 
    141     EBox::debug("$event->{w}{name}"); 
    142     _run($event->{w}{name} . $event->name()); 
     140    if (defined($event) and $event->IN_CREATE) { 
     141        _run($event->{w}{name} . $event->name()); 
     142    } 
    143143}; 
    144144 
     
    146146  or throw EBox::Exceptions::External("Unable to create a new inotify object: $!"); 
    147147 
    148 $inotify->watch(INCOMING_DIR, IN_CREATE, $incomingSub); 
    149 $inotify->watch(INCOMING_DIR, IN_DELETE_SELF, sub {}); 
     148$inotify->watch(INCOMING_DIR, IN_CREATE|IN_DELETE_SELF, $incomingSub); 
    150149# Run those directories which have not run previously 
    151150_runRemainder(); 
     
    159158        if ( $evt->IN_DELETE_SELF ) { 
    160159            EBox::warn(INCOMING_DIR . " has been deleted! Stopping daemon..."); 
    161             exit(0); 
     160            exit(1); 
    162161        } 
    163         $evt->{w}{cb}; 
     162        # Run the watcher callback 
     163        $evt->{w}{cb}(); 
    164164    } 
    165165}