让apach 开机自启动

简介:


在linux 源码编译安装了apache 服务

apache 服务启动命令:
/usr/local/apache/bin/apachectl start  或是把apachectl 软链接或cp到 /sbin目录下

apachectl start


用chkconfig 工具让apache服务运行在运行级别345下面,  命令如下:


cp  /usr/local/apache/bin/apachectl /etc/init.d/apachectl

ln -s /etc/init.d/apachectl /etc/rc.d/rc3.d/apachectl

vi /etc/init.d/apachectl

在行  #!/bin/sh  下,添加一行

# chkconfig: 345 85 15


chkconfig --add apachectl


到此 apache服务就可以在运行级别345下 随机自动启动了。


另外,也可把启动命令 /usr/local/apache/bin/apachectl start 直接写入 /etc/rc.d/rc.local 文件中,达到开启启动的目的



      本文转自笔下生辉  51CTO博客,原文链接:http://blog.51cto.com/752030200/1726555,如需转载请自行联系原作者





相关文章
|
7月前
|
Shell Linux 开发工具
【异常解决】vim编辑文件时提示 Found a swap file by the name “.start.sh.swp“的解决方案
【异常解决】vim编辑文件时提示 Found a swap file by the name “.start.sh.swp“的解决方案
99 0
|
Shell Linux
Centos7:“Entering emergency mode. Exit the shell to continue”错误解决方法
想过很多朋友有遇到这种情况,就是正在远程使用centos7系统时,一旦让远程虚拟机或服务器断电或强制关机,那么再次重启时就会出现“Entering emergency mode. Exit the shell to continue.”的错误。
10200 1
Centos7:“Entering emergency mode. Exit the shell to continue”错误解决方法
|
Ubuntu
ubuntu启动virtualbox出错解决办法:RTR3InitEx failed with rc=-1912 (rc=-1912)
ubuntu启动virtualbox出错解决办法:RTR3InitEx failed with rc=-1912 (rc=-1912)
400 0
ubuntu启动virtualbox出错解决办法:RTR3InitEx failed with rc=-1912 (rc=-1912)
armbian下使用/etc/rc.local实现开机启动自己的多个程序
刚刚折腾完的事情,就是通过/etc/rc.local中增加我的程序启动命令。这里遇到一个问题,发现只能启动一个,然后百度查询,有人提到这是因为程序运行之后占用了命令行,不返回,所以不再继续执行,于是写了程序分成子进程的方案,虽然代码已经给出,但是对我来讲还是太难了点,继续寻找其他方案,还真找到了,只需要增加一个 &符号分割就可以再执行另外一个程序的启动命令了。
1444 0
|
Linux
16.7 Linux /etc/rc.d/rc.local配置文件
在 /etc/rc[06].d/ 目录中的程序启动之后,系统的启动就已经完成。不过,我们总有一些程序是需要在系统启动之后随着系统一起启动的。这时我们并不需要自己把需要启动的服务链接到 /etc/rc3.d/ 目录中,因为系统给我们准备了 /etc/rc.d/rc.local 配置文件。
213 0
16.7 Linux /etc/rc.d/rc.local配置文件
|
Linux 虚拟化
安装centos7 报错[FAILED] Failed to start Switch Root. see 'systemctl status initrd-switch-root.service' for details
安装centos7 报错[FAILED] Failed to start Switch Root. see 'systemctl status initrd-switch-root.service' for details
24053 0