这里主要讲解rpm安装的独立服务的管理,这里的独立是相对于xinted 而言的。
rpm包安装的默认位置
/etc/init.d 启动脚本位置
/etc/sysconfig 初始化环境配置文件位置
/etc 配置文件位置
/etc/xinetd.conf xinetd配置文件位置
/etc/xinetd.d 基于xinetd服务的启动脚本
/var/lib 服务产生的数据放在这里
/var/log 日志
独立服务的启动方法
/etc/init.d/独立服务名 start|stop|status|restart
service 独立服务名 start|stop|restart|status
据说service是redhat专有命令
service --status-all 列出系统中所有rpm安装的包的状态
独立服务的自启动
1.chkconfig [--level 运行级别] [独立服务名] [on|off]
2.修改/etc/rc.d/rc.local文件(ubuntu /etc/init.d/rc 或者 rc.local)
3.使用ntsysv命令管理自启动(图形界面类似于setup)
[root@Liu-Centos init.d]# chkconfig --list | grep httpd
httpd 0:关闭 1:关闭 2:关闭 3:关闭 4:关闭 5:关闭 6:关闭
[root@Liu-Centos init.d]# chkconfig --level 2345 httpd on
[root@Liu-Centos init.d]# chkconfig --list | grep httpd
httpd 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
[root@Liu-Centos init.d]# chkconfig --level 2345 httpd off
[root@Liu-Centos init.d]# vim /etc/rc.d/rc.local (linux自启动时会读取该文件)
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
/etc/rc.d/init.d/httpd start