源码包安装服务的启动
使用绝对路径,调用启动脚本来启动
不同源码包的启动脚本不同
查看源码包的安装说明,查看启动脚本的方法
/usr/local/apache2/bin/apachectl start|stop
源码包服务的自启动
vim /etc/rc.d/rc.local
加入
/usr/local/apache2/bin/apachectl start
让源码包服务被服务管理命令识别
ls -s /usr/local/apache2/bin/apachectl /etc/init.d/apache
这时就可以用 service apache 去管理了
让源码包被chkconfig 和 ntsysv命令管理自启动
上一步骤的软连接已经建立
[root@Liu-Centos bin]# vim /etc/init.d/apache
加入
#chkconfig: 35 85 76
指定源码包安装的apache可以被chkconfig命令管理自启动
格式是 chkconfig:运行级别启动顺序关闭顺序
#description: source package apache
说明 内容随意
#!/bin/sh
#chkconfig: 35 86 76
#description: source package apache
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
[root@Liu-Centos ~]# chkconfig --add apache(把源码包安装的服务加进来)
[root@Liu-Centos ~]# chkconfig --list | grep apache
apache 0:关闭 1:关闭 2:关闭 3:启用 4:关闭 5:启用 6:关闭
[root@Liu-Centos ~]# chkconfig apache on
[root@Liu-Centos ~]# chkconfig --list | grep apache
apache 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
这个里设计的启动顺序和关闭顺序,不能和系统自己的重复。
怎么确定现有系统的关闭启动顺序
[root@Liu-Centos ~]# vim /etc/rc.d/rc3.d/
K01numad K88sssd S13rpcbind S55sshd
K01smartd K89rdisc S14nfslock S56xinetd
K02oddjobd K95cgconfig S15mdmonitor S80postfix
K10psacct K99rngd S18rpcidmapd S82abrt-ccpp
K10saslauthd S01sysstat S19rpcgssd S82abrtd
K50netconsole S02lvm2-monitor S20kdump S82abrt-oops
K60nfs S08ip6tables S22messagebus S85httpd
K69rpcsvcgssd S08iptables S24avahi-daemon S90crond
K73ypbind S10network S25cups S95atd
K74ntpd S11auditd S25netfs S99certmonger
K75ntpdate S11portreserve S26acpid S99local
K75quota_nld S12rsyslog S26haldaemon
K86cgred S13cpuspeed S26udev-post
K87restorecond S13irqbalance S28autofs
比如第三级别纯字符界面,开始是以S开头开始,结束以K开头开始按顺序走。