我想在我的OpenSuse 12.3服务器启动时运行已编译的apache2服务器。
我遵循https://serverfault.com/questions/16839/how-do-i-get-apache-to-startup-at-bootime-on-linux中列出的程序,即:
创建文件/etc/init.d/apache2
使用
将其添加到服务中chkconfig --add apache2
我可以看到它在YaST的运行级别管理器中列出(不确定我的发行版是西班牙语的确切名称)
apache2 Yes*
我认为这意味着服务配置为在启动时启动但在我检查时没有运行。
我的/etc/init.d/apache2的内容是:
#!/bin/bash
#
### BEGIN INIT INFO
# Provides: apache2
# Default-Start: 3 5
# Description: Controlar el servidor apache2
### END INIT INFO
/home/servidor/apache/bin/apachectl $@
我尝试过更改文件的权限,通过systemd启用服务,几乎我在网上找到的所有内容都无济于事:
systemctl start apache2.service
systemctl enable apache2.service
chkconfig apache2 on
非常感谢任何帮助。
答案 0 :(得分:2)
您是否尝试在init.d文件中添加chkconfig支持行?
# chkconfig: - 85 15
# description: Apache is a World Wide Web server. It is used to serve \
# HTML files and CGI.
# processname: httpd
# config: /etc/httpd/conf/httpd.conf
# config: /etc/sysconfig/httpd
# pidfile: /var/run/httpd.pid
当然,相应地更改路径和值。有关详细信息,请查看https://code.google.com/p/xinc/issues/detail?id=145。它不是openSuse论坛,但chkconfig也适用于openSuse 12.3。