Linux下注册Apache为系统服务
1:vi /etc/rc.d/rc.local
增加:/usr/local/httpd/bin/apachectl start
2:[注册为Service]
cp /usr/local/httpd/bin/apachectl /etc/rc.d/init.d/httpd
vi httpd
找到:#!/bin/sh
另起一行,增加:
# chkconfig: 35 70 30
# description: Apache
Ok~
然后注册服务:chkconfig --add httpd
----
启动服务:service httpd start
停止服务:service httpd stop
重新启动:service httpd restart
又搜了一下其他的方法:
mysql设为linux服务
cp /usr/local/mysql5/share/mysql/mysql.server /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig --level 2345 mysqld on
chown mysql:mysql -R /usr/local/mysql5/
service mysqld start
apache设为linux服务
cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd
vi /etc/init.d/httpd
在在#!/bin/sh后面加入下面两行
#chkconfig:345 85 15
#description: Start and stops the Apache HTTP Server.
然后
chmod +x /etc/rc.d/init.d/httpd
chkconfig --add httpd
1:vi /etc/rc.d/rc.local
增加:/usr/local/httpd/bin/apachectl start
2:[注册为Service]
cp /usr/local/httpd/bin/apachectl /etc/rc.d/init.d/httpd
vi httpd
找到:#!/bin/sh
另起一行,增加:
# chkconfig: 35 70 30
# description: Apache
Ok~
然后注册服务:chkconfig --add httpd
----
启动服务:service httpd start
停止服务:service httpd stop
重新启动:service httpd restart
又搜了一下其他的方法:
mysql设为linux服务
cp /usr/local/mysql5/share/mysql/mysql.server /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig --level 2345 mysqld on
chown mysql:mysql -R /usr/local/mysql5/
service mysqld start
apache设为linux服务
cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd
vi /etc/init.d/httpd
在在#!/bin/sh后面加入下面两行
#chkconfig:345 85 15
#description: Start and stops the Apache HTTP Server.
然后
chmod +x /etc/rc.d/init.d/httpd
chkconfig --add httpd
版权所有:《太阳花工作室》 => 《Linux下注册Apache为系统服务》
本文地址:http://bg.artuion.com/linux/114.html
除非注明,文章均为 《太阳花工作室》 原创,欢迎转载!转载请注明本文地址,谢谢。