Commit ee35dc1c authored by Boxiang Sun's avatar Boxiang Sun

monitor: Allow httpd to restart after the sever reboot from poweroff

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
parent 54a08186
Pipeline #30066 passed with stage
in 0 seconds