linux服务管理---独立服务和基于xinetd服务的管理
2015-07-01 17:01
821 查看
/etc/init.d/ | 启动脚本的位置 |
/etc/sysconfig/ | 初始化环境配置文件 |
/etc/ | 配置文件 |
/etc/xinetd.conf | xinetd配置文件 |
/etc/xinetd.d | 基于xinetd服务的启动脚本 |
/var/lib/ | 服务产生的数据存放位置 |
/var/log/ | 产生的日志 |
/etc/init.d/ServiceName start|stop|status|restart(标准方法)
service ServiceName start|stop|status|restart(红帽系列方法)
自启动的设置
chkconfig --level 2345 httpd on ##2345为系统运行级别
chkconfig --level 2345 httpd off 或者 chkconfig httpd off ##chkconfig 默认设置系统级别就为2345,故可省略
方法二(推荐):修改/etc/rc.d/rc.local
在末行添加
/etc/rc.d/init.d/httpd start
即可在开机时运行上面这个命令
优点:1.通过该文件可快速确定开机自启动的服务有哪些。
2.支持源码包安装的服务自启动。
PS:touch /var/lock/subsys/local这个动作使得local这个文件的最后修改时间为最后一次的开机时间
方法三:安装ntsysv,可视化进行设备开机自启动。(红帽系列专用)
好处是管理独立的服务和基于xinetd的服务。
坏处是无法识别源码包安装的服务
基于xinetd的服务启动
原理:xinetd的启动和自启动为同一含义,开启服务意味着自启动服务。关闭它也就等于开机不自启动。
开启方法:
进入/etc/xinetd.d/目录下,找到要开启的服务,打开对应配置文件,将其中的disable项改为no
例如:
[root@localhost sh]# vi /etc/xinetd.d/telnet # default: on # description: The telnet server serves telnet sessions; it uses \ # unencrypted username/password pairs for authentication. service telnet { flags = REUSE socket_type = stream wait = no user = root server = /usr/sbin/in.telnetd log_on_failure += USERID disable = <span style="color:#ff0000;"><strong>no</strong></span>改完之后重启xinetd服务
# service xinetd restart
可以在netstat -tlun中查看到23端口已打开。
关闭的方法有两种
方法一:chkconfig telnet off
方法二:仍然修改/etc/xinetd.d/目录下,找到要开启的服务,打开对应配置文件,将其中的disable项改为yes,然后重启xinetd服务。
相关文章推荐
- Linux socket 初步
- 10 篇对初学者和专家都有用的 Linux 命令教程
- Linux 与 Windows 对UNICODE 的处理方式
- Ubuntu12.04下QQ完美走起啊!走起啊!有木有啊!
- 解決Linux下Android开发真机调试设备不被识别问题
- 运维入门
- 运维提升
- Linux 自检和 SystemTap
- Ubuntu Linux使用体验
- c语言实现hashmap(转载)
- Linux 信号signal处理机制
- linux下mysql添加用户
- Scientific Linux 5.5 图形安装教程
- 基于 Linux 集群环境上 GPFS 的问题诊断
- 谁是桌面王者?Win PK Linux三大镇山之宝
- vivi下重新调整分区
- Linux VS Unix:Linux欲一统天下 Unix不死
- linux下设定环境变量
- Linux下修改MySQL编码的方法