Chinaunix首页 | 论坛 | 博客
  • 博客访问: 475458
  • 博文数量: 111
  • 博客积分: 3146
  • 博客等级: 中校
  • 技术积分: 939
  • 用 户 组: 普通用户
  • 注册时间: 2009-07-07 11:23
个人简介

Nathing

文章分类

全部博文(111)

文章存档

2016年(2)

2015年(1)

2014年(31)

2012年(2)

2011年(9)

2010年(36)

2009年(30)

我的朋友

分类: LINUX

2009-07-21 16:44:29

daemon

登录档的 syslog 这支 daemon 的初始化设定就写入在 /etc/sysconfig/syslog:
[root@www ~]# /etc/init.d/syslog 
用法: /etc/init.d/syslog
{start|stop|status|restart|condrestart} 
# 什么参数都不加的时候,系统会告诉你可以用的参数有哪些,如上所示。
 
范例一:观察 syslog 这个 daemon 目前的状态 
[root@www ~]# /etc/init.d/syslog status
 
范例二:重新让 syslog 读取一次配置文件 
[root@www ~]# /etc/init.d/syslog restart 
正在关闭核心记录器: [ 确定 ] 
正在关闭系统记录器: [ 确定 ] 
正在启动系统记录器: [ 确定 ] 
正在启动核心记录器: [ 确定 ]
 
由于系统的环境都已经帮你制作妥当,所以利用 /etc/init.d/* 来启动、关闭与观察,就非常的简单!
话虽如此, CentOS 还是有提供另外一支可以启动 stand alone 服务的脚本喔,那就是 service 这个程序。 其实 service 仅是一支 script 啦,他可以分析你下达的 service 后面的参数,然后根据你的参数再到 /etc/init.d/ 去取得正确的服务来 start 或 stop 哩!他的语法是这样的啦:
[root@www ~]# service [service name] (start|stop|restart|...) 
[root@www ~]# service --status-all 
选项与参数: 
service name:亦即是需要启动的服务名称,需与 /etc/init.d/ 对应; 
start|... :亦即是该服务要进行的工作。 
--status-all:将系统所有的 stand alone 的服务状态通通列出来
 
范例三:重新启动 crond 这支 daemon : 
[root@www ~]# service crond restart 
[root@www ~]# /etc/init.d/crond restart 
# 这两种方法随便你用哪一种来处理都可以!
 
Super daemon 的启动方式
必须要在配置文件中设定为启动该 daemon 才行。配置文件就是 /etc/xinetd.d/* 的所有档案。那如何得知 super daemon 所管理的服务是否有启动呢?你可以这样做:
[root@www ~]# grep -i 'disable' /etc/xinetd.d/* 
....(前面省略).... 
/etc/xinetd.d/rsync:         disable = yes 
/etc/xinetd.d/tcpmux-server: disable = yes 
/etc/xinetd.d/time-dgram:    disable = yes 
/etc/xinetd.d/time-stream:   disable = yes
 
!假设我想要启动如上的 rsync 这个服务,那么你可以这样做:
# 1. 先修改配置文件成为启动的模样: 
[root@www ~]# vim /etc/xinetd.d/rsync 
# 请将 disable 那一行改成如下的模样 (原本是 yes 改成 no 就对了) 
service rsync 

        disable = no 
        ....(后面省略)....
 
 
# 2. 重新启动 xinetd 这个服务 
[root@www ~]# /etc/init.d/xinetd restart
 
# 3. 观察启动的埠口 
[root@www ~]# grep 'rsync' /etc/services <==先看看埠口是哪一号 
rsync 873/tcp # rsync 
rsync 873/udp # rsync 
[root@www ~]# netstat -tnlp | grep 873 
tcp 0 0 0.0.0.0:873 0.0.0.0:* LISTEN 4925/xinetd 
# 注意看!启动的服务并非 rsync 喔!而是 xinetd ,因为他要控管 rsync 嘛!
 
既然这家伙这么重要,那么底下我们就来谈谈 xinetd 这个服务的预设配置文件 /etc/xinetd.conf ,以及各个设定项目的意义啰!
p15
 
阅读(426) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~