I ran into a problem with auto-starting one of the Apache server instances on AIX. After a power failure, regardless of what the root cause was, run of AIX, including the layers, aborted incorrectly. A manual test showed that the Apache server instance could not be started because of an existing process with the pid recorded in the httpd pid file (because the pid file was not removed due to the power failure). After removing the relict httpd pid file, the Apache server instance could start properly.
It would be expected that the apachectl_64 startup script and the httpd binary should be able to solve this problem because:
- after booting during the rc.2 phase, it is the first instance's run and there should be no httpd pid file - so if any httpd pid file exists, it is out of date.
- the pid process recorded in the httpd pid file is not an httpd process, and if it were an httpd process, its parameters (-f, -d) would not be correct (=expected)
Sure is possible to add an script for preventive test of httpd pid file and if exists removing one during rc.d phase of boot, but clear solution(based on knowledge httpd) would be expected.
Below is a list of commands to manually start a second Apache server:
aix:/system>apachectl2_64 -k start -f httpd-second.conf_64 -d /opt/freeware/etc/httpd/conf/
httpd (pid 13369758) already running
aix:/system>ps -ef | grep 13369758
root 13369758 9306596 0 23:02:33 - 0:00 /sysdba/bin/db XXX
aix:/system>ls -l /var/run/httpd*
-rw-r--r-- 1 root system 9 Oct 10 23:03 /var/run/httpd.pid
-rw-r--r-- 1 root system 9 Oct 11 00:19 /var/run/httpd_second.pid
aix:/opt/freeware/etc/httpd/conf>rm /var/run/httpd_second.pid
aix:/system>apachectl2_64 -k start -f httpd-second.conf_64 -d /opt/freeware/etc/httpd/conf/
aix:/system>apachectl2_64 status
Apache Server Status for aixxx.xx.xx.x (via x.x.x.x)
Server Version: Apache/2.4.58 (Unix) OpenSSL/1.1.1x
Server MPM: worker
........
------------------------------
Jan Simko
------------------------------