X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FDaemon.pm;h=ca181345a493fc38784ad0cf29e2fd28459f237c;hb=e9f753f206b65959aad98098447f31e3a060d231;hp=3e64f79e95e1d7a17f12dda2d8306d418392c462;hpb=beba6672fb9c9c5769c81f8029bb88cd2bc910e9;p=freeside.git diff --git a/FS/FS/Daemon.pm b/FS/FS/Daemon.pm index 3e64f79e9..ca181345a 100644 --- a/FS/FS/Daemon.pm +++ b/FS/FS/Daemon.pm @@ -5,13 +5,17 @@ use vars qw( $pid_dir $me $pid_file $sigint $sigterm $logfile ); use Exporter; use Fcntl qw(:flock); use POSIX qw(setsid); +use IO::File; use Date::Format; #this is a simple refactoring of the stuff from freeside-queued, just to #avoid duplicate code. eventually this should use something from CPAN. @ISA = qw(Exporter); -@EXPORT_OK = qw( daemonize1 drop_root daemonize2 sigint sigterm logfile ); +@EXPORT_OK = qw( + daemonize1 drop_root daemonize2 myexit logfile sigint sigterm +); +%EXPORT_TAGS = ( 'all' => [ @EXPORT_OK ] ); $pid_dir = '/var/run'; @@ -73,6 +77,11 @@ sub sigterm { $sigterm; } sub logfile { $logfile = shift; } #_logmsg('test'); } +sub myexit { + unlink $pid_file if -e $pid_file; + exit; +} + sub _die { my $msg = shift; unlink $pid_file if -e $pid_file;