• Boxiang Sun's avatar
    monitor: Allow httpd to restart after the sever reboot from poweroff · ee35dc1c
    Boxiang Sun authored
    If a server reboots brutally, there will be a legacy httpd pid file stay
    in the file system, and the OS may reuse the PID that remains in that
    file, which will cause httpd service to fail to start even if there is
    no such httpd service is running.
    
    This commit implemented the following logic:
    0. If there is no existing PID file, then run the httpd service directly
    1. If the PID file exists and contains the PID used by another process,
    we delete the PID file, then restart the httpd service
    2. If the PID file exists and contains the PID used by another running
    httpd service, we allow the httpd report the "already running" error
    normally
    ee35dc1c