[Linux]将程序加入centos的系统服务
2011-07-21 19:28
609 查看
将程序加入centos的系统服务
系统服务里面没有apache或者httpd服务,每次启动都要/usr/local/apache2/bin/apachectl start
比较麻烦,下面的操作可以将httpd装入到服务中,同理也可以用到其他的服务操作
1、将apachectl文件拷贝到/etc/rc.d/init.d 中,然后在/etc/rc.d/rc5.d/下加入链接即可。
命令如下:
cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd //如果有其他的版本的Apache存在,也可以直接覆盖掉
ln -s /etc/init.d/httpd /etc/rc.d/rc5.d/S85httpd //建立链接(85的意义后面介绍)
此时Apache就可以自动启动了。
2、 运行chkconfig –list,发现没有linux服务列表中httpd,通过chkconfig –add httpd来添加,但是提示:httpd服务不支持 chkconfig。需要编辑/etc/rc.d/init.d/httpd,添加以下注释信息:
# chkconfig: 345 85 15
# description: Activates/Deactivates Apache Web Server
第一行3个数字参数意义分别为:哪些Linux级别需要启动httpd(3,4,5);启动序号(85);关闭序号(15)。
保存后执行:chkconfig –add httpd,成功添加。
在rc3.d、rc4.d、rc5.d路径中会出现S85httpd的链接文件,其他运行级别路径中会出现K61httpd的链接文件。
3、运行chkconfig –list httpd
相关文章推荐
- CentOS 7将linux服务加入系统启动 systemd service
- Linux(CentOS)系统下安装好apache(httpd)服务后,其他电脑无法访问的原因
- linux将jboss加入系统服务
- Linux学习之CentOS(三十二)--Linux系统服务基础
- Linux环境把Mysql和Apache加入到系统服务里面
- Linux的init程序与系统服务管理
- Linux环境把Mysql和Apache加入到系统服务里面
- XP下安装Centos 6.4 双系统 :Linux系统分区及挂载点,关键引导程序启动设置
- Linux下将Mysql和Apache加入到系统服务里的方法
- Linux下将Mysql和Apache加入到系统服务里的方法
- 用sc.exe将程序加入windows系统服务
- Linux中将Apache加入到系统服务
- Linux下把Mysql和Apache加入到系统服务里
- Linux(CentOS6.5)下Nginx注册系统服务(启动、停止、重启、重载等)&设置开机自启
- linux下 init程序与系统服务启动管理
- linux中apache和mysqld加入service系统服务中
- Linux系统CentOS 7修改httpd服务Apache网站根目录/var/www/html
- CentOS Linux下配置Oracle 11gR2为系统服务自动启动
- 在Centos中 将apache httpd 服务加入系统服务
- linux 把nginx加入到系统服务,并开机自己启动的方法