Commit b8bf6903 authored by Leigh B Stoller's avatar Leigh B Stoller

Cleanup init/remote of the pidfile in /var/run and add a sig handler

for reopening the logfile for the benefit of newsyslog.
parent 5110abc4
......@@ -33,7 +33,7 @@ my $TBLOGS = "@TBLOGSEMAIL@";
my $PGENIDOMAIN = "@PROTOGENI_DOMAIN@";
my $PGENISUPPORT = @PROTOGENI_SUPPORT@;
my $PGENICLRHOUSE = @PROTOGENI_CLEARINGHOUSE@;
my $LOGFILE = "$TB/log/geniexpire.cm";
my $LOGFILE = "$TB/log/expire_daemon.log";
my $IDLETIMES = "$TB/sbin/idletimes";
my $EMULAB_PEMFILE = "$TB/etc/genicm.pem";
my $REGISTER = "$TB/sbin/protogeni/register_sliver";
......@@ -105,12 +105,32 @@ Genixmlrpc->SetTimeout(10);
$ENV{'MYUUID'} = $certificate->uuid();
$ENV{'MYURN'} = "urn:publicid:IDN+@OURDOMAIN@+authority+cm";
if (CheckDaemonRunning("expire_daemon")) {
fatal("Not starting another expire daemon!");
}
# Go to ground.
if (! $debug) {
if (TBBackGround($LOGFILE)) {
exit(0);
}
}
if (MarkDaemonRunning("expire_daemon")) {
fatal("Could not mark daemon as running!");
}
#
# Setup a signal handler for newsyslog.
#
sub handler()
{
my $SAVEEUID = $EUID;
$EUID = 0;
ReOpenLog($LOGFILE);
$EUID = $SAVEEUID;
}
$SIG{HUP} = \&handler
if (!$debug);
GeniUtil::FlipToGeniUser();
#
......@@ -289,16 +309,6 @@ sub RegisterSlices()
}
}
#
# Setup a signal handler for newsyslog.
#
sub handler()
{
ReOpenLog($LOGFILE);
}
$SIG{HUP} = \&handler
if (!$debug);
while (1) {
next
if (NoLogins());
......@@ -331,7 +341,7 @@ sub fatal($)
"ProtoGENI expire daemon died",
$msg,
$TBOPS);
MarkDaemonStopped("expire_daemon");
die("*** $0:\n".
" $msg\n");
}
......@@ -101,12 +101,32 @@ Genixmlrpc->SetTimeout(10);
$ENV{'MYUUID'} = $certificate->uuid();
$ENV{'MYURN'} = "urn:publicid:IDN+@OURDOMAIN@+authority+sa";
if (CheckDaemonRunning("sa_daemon")) {
fatal("Not starting another sa daemon!");
}
# Go to ground.
if (! $debug) {
if (TBBackGround($LOGFILE)) {
exit(0);
}
}
if (MarkDaemonRunning("sa_daemon")) {
fatal("Could not mark daemon as running!");
}
#
# Setup a signal handler for newsyslog.
#
sub handler()
{
my $SAVEEUID = $EUID;
$EUID = 0;
ReOpenLog($LOGFILE);
$EUID = $SAVEEUID;
}
$SIG{HUP} = \&handler
if (!$debug);
GeniUtil::FlipToGeniUser();
#
......@@ -366,16 +386,6 @@ sub RenewSlices()
}
}
#
# Setup a signal handler for newsyslog.
#
sub handler()
{
ReOpenLog($LOGFILE);
}
$SIG{HUP} = \&handler
if (!$debug);
while (1) {
next
if (NoLogins());
......@@ -406,6 +416,7 @@ sub fatal($)
$msg,
$TBOPS);
MarkDaemonStopped("sa_daemon");
die("*** $0:\n".
" $msg\n");
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment