Subversion Repositories DevTools

Rev

Rev 7396 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7396 Rev 7423
Line 138... Line 138...
138
 
138
 
139
#
139
#
140
#   Locate and start up new transfer targets
140
#   Locate and start up new transfer targets
141
#
141
#
142
Utils::writepid($conf);
142
Utils::writepid($conf);
143
sighandlers($conf);
143
sighandlers();
144
while ( 1 )
144
while ( 1 )
145
{
145
{
146
    readConfig();
146
    readConfig();
147
 
147
 
148
    #
148
    #
Line 182... Line 182...
182
#        setsid or $logger->err("Can't start a new session: $!");
182
#        setsid or $logger->err("Can't start a new session: $!");
183
        $logger->logmsg("Started $target");
183
        $logger->logmsg("Started $target");
184
 
184
 
185
        #
185
        #
186
        #   Determine the daemon to run
186
        #   Determine the daemon to run
187
        #       Based on the name of the config file
187
        #   Based on the name of the config file
-
 
188
        #       Use the basename of the config file
188
        #       There are a few special daemons
189
        #       Uppercase the first letter
-
 
190
        #       If there is a perl file of this name in the rootDir then use it
189
        my $daemon = "$rootDir/blatDaemon.pl";
191
        #       Otherwise use the default of blatDaemon
-
 
192
        #   
190
        if ($target =~ m~/tarZip~ ) {
193
        $target =~ m~.*/(.*)\.conf$~;
191
                $daemon = "$rootDir/blatTarZip.pl"
194
        my $daemon = $rootDir . '/blat' . ucfirst($1) . '.pl';
192
        } elsif ($target =~ m~/s3Sync~) {
195
        unless (-f $daemon) {
193
            $daemon = "$rootDir/blatS3Sync.pl"
196
            $daemon = "$rootDir/blatDaemon.pl";
194
        }
197
        }
195
 
-
 
-
 
198
        $logger->verbose("Start: $daemon $target");
196
        exec 'perl',$daemon, $target or $logger->err ("Can't exec $daemon");
199
        exec 'perl',$daemon, $target or $logger->err ("Can't exec $daemon");
197
    }
200
    }
198
 
201
 
199
    #
202
    #
200
    #   What a bit and try again
203
    #   What a bit and try again
Line 288... Line 291...
288
#-------------------------------------------------------------------------------
291
#-------------------------------------------------------------------------------
289
# Function        : sighandlers
292
# Function        : sighandlers
290
#
293
#
291
# Description     : Install signal handlers
294
# Description     : Install signal handlers
292
#
295
#
293
# Inputs          : $conf           - System config
296
# Inputs          : None
294
#
297
#
295
# Returns         : Nothing
298
# Returns         : Nothing
296
#
299
#
297
sub sighandlers
300
sub sighandlers
298
{
301
{
299
    my $conf = shift;
-
 
300
    my $logger = $conf->{logger};
-
 
301
 
-
 
302
    $SIG{TERM} = sub {
302
    $SIG{TERM} = sub {
303
        # On shutdown
303
        # On shutdown
304
        $logger->logmsg('Received SIGTERM. Shutting down....' );
304
        $logger->logmsg('Received SIGTERM. Shutting down....' );
305
        foreach my $entry ( keys %children )
305
        foreach my $entry ( keys %children )
306
        {
306
        {