#!/usr/bin/perl use 5.12.2; # so that it should run under cron with the right DB2 environment BEGIN { unless ($ENV{DB2INSTANCE}) { exec ( ". ~db2inst1/sqllib/db2profile; exec $^X $0" . join '', map { qq[ "$_"] } @ARGV ); } } use strict; use warnings; # for easier testing in my module build tree. use blib; use CBStats::Fetch; use Daemon::Generic; newdaemon(); sub isfg { shift->{gd_foreground} } sub gd_preconfig { my $self = shift; () } sub gd_run { my $self = shift; my $fetcher = CBStats::Fetch->new(); $fetcher->run( quiet => !$self->isfg(), daemon => $self, ); } # let the CBStats::Fetch module set up its own # signals by preventing Daemon::Generic from doing so. sub gd_setup_signals { } # probably not needed anymore. sub gd_redirect_output { my $self = shift; return if $self->isfg; $self->SUPER::gd_redirect_output(); my $s = select STDOUT; $|=1; select STDERR; $|=1; select $s; }