communigate provisioning phase 2: add svc_domain.trailer -> communigate TrailerText...
[freeside.git] / FS / FS / Daemon.pm
index 3e64f79..ca18134 100644 (file)
@@ -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;