Issue #4 resolved

iRedAPD stops on being sent HUP signal

vic viq
created an issue

I changed manually newsyslog entry for iredapd to what is present in HEAD: /var/log/iredapd.log root:wheel 640 7 * 24 Z /var/run/iredapd.pid

but with that line iredapd just stops running and needs to be manually restarted

Comments (4)

  1. vic viq reporter

    No, nothing.

    # pgrep -fl ired
    41780 /usr/local/bin/python /opt/iredapd/src/iredapd.py /opt/iredapd/etc/iredapd.ini
    
    # cat /var/run/iredapd.pid 
    41780
    
    # newsyslog -v -F /var/log/iredapd.log
    Processing /etc/newsyslog.conf
    /var/log/iredapd.log <7Z>:  age (hr): 0 [24] --> trimming log....
    Signal all daemon process(es)...
    Notified daemon pid 41780 = /var/run/iredapd.pid
    Pause 10 seconds to allow daemon(s) to close log file(s)
    Compress all rotated log file(s)...
    
    # pgrep -fl ired
    

    returns nothing, process is not running anymore Same if I just send HUP to process indicated in /var/run/iredapd.pid

  2. Zhang Huangbin repo owner

    Fixed. With below patch, iRedAPD will ignore SIGHUP and continue running:

    diff -r 78143bbcaf87 src/daemon.py
    --- a/src/daemon.py	Tue Jul 17 07:22:29 2012 +0800
    +++ b/src/daemon.py	Sun Aug 19 14:08:00 2012 +0800
    @@ -44,6 +44,7 @@
     import logging
     import os
     import sys
    +import signal
     
     # ---------------------------------------------------------------------------
     # Constants
    @@ -141,6 +142,9 @@
             log.debug('Creating new session')
             os.setsid()
         
    +        # Ignore SIGHUP
    +        signal.signal(signal.SIGHUP, signal.SIG_IGN)
    +
             # Fork a second child to ensure that the daemon never reacquires
             # a control terminal.
             log.debug('Forking second child.')
    
  3. Log in to comment