I have a new daemon (using Proc::Daemon) that I'd like to sighup to get it to reload config, but no matter what I do, it kills the daemon.
After:
Proc::Daemon::Init();
I use:
I get the message in the log, but then my daemon dies. I've tried changing the code inside to something simpler, but it doesn't seem to matter. On the other hand $SIG{HUP} = 'IGNORE' works fine.$SIG{HUP} = sub { if (defined $log) { undef $log; } $log = IO::File->new(LOGFILE, 'w'); $log->print(strftime("%m/%d/%Y %H:%M:%S", localtime),": Caught HUP, +reset logfile\n"); $log->print("pid = $$\n"); $log->autoflush(1); };
If I create a simple script it doesn't kill the program when I sighup it:
#!/usr/bin/perl $SIG{HUP} = sub { print "got hup\n"; }; while (1) { print "sleeping\n"; sleep(1); }
The searching I have done show's lots of examples of restarting the script, but I cannot find any that just reaload configs (well, perl daemons that reaload).
Is there something different about how sighup works on regular apps vs daemon apps?
Thanks for your time,
-Andy
In reply to SIGHUP with Proc::Daemon by jaandy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |