Commit cea215cf authored by Leigh Stoller's avatar Leigh Stoller

Add HUP handler to reopen log file, so we can use newsyslog on

wrapped daemons.
parent 31420265
#!/usr/bin/perl -w
#
# Copyright (c) 2004, 2005, 2006 University of Utah and the Flux Group.
# Copyright (c) 2004, 2005, 2006, 2016 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -125,6 +125,11 @@ sub Pcleanup($)
" [$PID]: wrapper exiting\n";
exit(0);
}
# Signal handler for newsyslog.
sub Loghandler()
{
ReOpenLog($logfile);
}
# Daemonize;
if (!$debug && TBBackGround($logfile)) {
......@@ -141,6 +146,9 @@ system("echo '$PID' > $pidfile") == 0 or
# Okay, cleanup function.
$SIG{TERM} = \&Pcleanup;
# And reopen logfile for newsyslog.
$SIG{HUP} = \&Loghandler
if (! $debug);
# Fully disconnect from bootup.
setsid();
......
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