I'm facing an odd problem on a Buildroot environment for RPi3.
I have this init.d service to start apache2 (version 2.4.57):
# cat /etc/init.d/S50apache
#!/bin/sh
case "$1" in
start|restart|graceful|graceful-stop|stop)
apachectl -k $1
;;
reload)
apachectl -k restart
;;
*)
echo "Usage: $0 {start|restart|reload|graceful|graceful-stop|stop}"
exit 1
esac
exit $?
Often, when I power up the RPi3 I notice the web server is not running. If I try to run the very same command, i.e.:
# apachectl -k start
I get:
httpd (pid 288) already running
but:
# ps aux | grep httpd
477 root grep httpd
and:
# ps aux | grep 288
288 root /usr/sbin/wpa_supplicant -u
457 root grep 288
It seems obvious (unless I'm missing something) that apache2 is not running and the PID 288 is about a completely different service.
In order to start the webserver I have to:
apachectl -k stop-> this actually stops thewpa_supplicantservice!- restart the
wpa_supplicantservice - now
apachectl -k startworks and theapache2service runs
Of course this is not acceptable. Furthermore, the machine will be unattended hence I need to fix this issue.
But I first have to understand why it happens. How is it possible it thinks it has a different PID?