Apache listed in runlevels, not starting at boot (OpenSuse 12.3)

apache-2.2bootopensuserunlevel

I want my compiled apache2 server to run when my OpenSuse 12.3 server boots.

I've followed the procedure listed in How do I get apache to startup at bootime on Linux, namely:

  • Creating the file /etc/init.d/apache2

  • Adding it to the services with

    chkconfig –add apache2

I can see it listed in YaST's runlevel manager (not sure about the exact name as my distro is in spanish) as

apache2 Yes*

I take it that this means that the service is configured to start at boot but isn't running when I check.

The content of my /etc/init.d/apache2 is:

#!/bin/bash
#
### BEGIN INIT INFO
# Provides:       apache2
# Default-Start:  3 5
# Description:    Controlar el servidor apache2
### END INIT INFO

/home/servidor/apache/bin/apachectl $@

I've tried changing the file's permissions, enabling the service through systemd and pretty much everything I've found online to no avail:

systemctl start apache2.service
systemctl enable apache2.service
chkconfig apache2 on

Any help would be greatly appreciated.

Edit

My custom service finally worked. After a reboot I executed

journalctl -n 

and realized that while the service was executing correctly after booting was done (via manual input in the terminal), running it during boot returned a failed status.

systemctl status apache2.service 

showed an issue with sockets not being open, so I googled the error and consequently changed my httpd.conf from

Listen 192.168.9.69:80

to

Listen *:80

Maybe the error arises because the IP adresses had not being assigned at that point?
Anyway, that solved it.

Thank you very much for you interest and time.

Best Answer

First of all, /home/servidor/apache is not an adequate path for an executable in a server. Use the /usr/local hierarchy for locally compiled packages. That is the default option, you should not change it.

With regards to the init script, adapt the one distributed with your distro to your needs. Just download the RPM and extract the /etc/init.d/apache2 file.

Related Topic