Chinaunix首页 | 论坛 | 博客
  • 博客访问: 794056
  • 博文数量: 858
  • 博客积分: 10000
  • 博客等级: 上将
  • 技术积分: 5015
  • 用 户 组: 普通用户
  • 注册时间: 2008-08-29 17:43
文章分类

全部博文(858)

文章存档

2011年(1)

2008年(857)

我的朋友

分类: LINUX

2008-08-29 17:50:11

 
CHKCONFIG(8)CHKCONFIG(8)

NAME
chkconfig-updatesandqueriesrunlevelinformationforsystemservices
更新并且询问系统服务的运行登记

SYNOPSIS
chkconfig--list[name]
chkconfig--addname
chkconfig--delname
chkconfig[--levellevels]name
chkconfig[--levellevels]name

DESCRIPTION
chkconfigprovidesasimplecommand-linetoolformaintaining
the/etc/rc[0-6].ddirectoryhierarchybyrelievingsystemadministrators
ofthetaskofdirectlymanipulatingthenumeroussymboliclinksin
thosedirectories.

chkconfig提供了一个简单的命令行工具用于维护/etc/rc[0-6].d的路径层次,可以帮助系统管理员在这些路径中直接操作符号行
PS:简单的说就是用于维护/etc/rc[0.6].d的命令行,用不着这么麻烦

Thisimplementationofchkconfigwasinspiredbythechkconfigcommand
presentintheIRIXoperatingsystem.Ratherthanmaintainingconfigu-
rationinformationoutsideofthe/etc/rc[0-6].dhierarchy,however,
thisversiondirectlymanagesthesymlinksin/etc/rc[0-6].d.This
leavesalloftheconfigurationinformationregardingwhatservices
initstartsinasinglelocation.

chkconfig的执行是通过chkconfig命令激发的,此命令目前在irix操作系统中存在。甚至包括了维护/etc/rc[0-6].d层次之外的设置信息
但是本版本命令直接管理在/etc/rc[0-6].d中的符号行,这些设置信息主要是关于哪些服务在机器启动的时候就已经运行
PS:简单的说,就是chkconfig命令在irix操作系统中统统存在,甚至可以管理其他信息,但是我们这个说明,主要是关于那种服务在启动的时候自动运行,至于irix是sgi公司基于unix的图形工作站的应用软件,不是操作系统

chkconfighasfivedistinctfunctions:addingnewservicesformanage-
ment,removingservicesfrommanagement,listingthecurrentstartup
informationforservices,changingthestartupinformationforser-
vices,andcheckingthestartupstateofaparticularservice.

chkconfig有5个不同的函数:为管理器添加新服务,从管理器中移出服务,列出当前启动的服务信息,改变服务启动信息,检查特殊服务的启动状态

Whenchkconfigisrunwithoutanyoptions,itdisplaysusageinforma-
tion.Ifonlyaservicenameisgiven,itcheckstoseeiftheservice
isconfiguredtobestartedinthecurrentrunlevel.Ifitis,chkcon-
figreturnstrue;otherwiseitreturnsfalse.The--leveloptionmaybe
usedtohavechkconfigqueryanalternativerunlevelratherthanthe
currentone.

当chkconfig没有任何参数运行的时候,它会显示用法信息,如果仅仅给了一个服务名称,他会去检查服务在目前的运行级别上是否被设定是可以运行的,如果可以运行的话,chkconfig返回true;不然的话返回false.--level选项被用来询问相对于目前运行等级,之外的一种运行登记
PS:返回true就是shell里什么都没有,--level是用来查询服务在其他等级是否可以运行的

Ifoneofon,off,orresetisspecifiedaftertheservicename,chk-
configchangesthestartupinformationforthespecifiedservice.The
initscriptinquestion.

如果onoffreset跟在服务明后面,那么chkconfig会改变特定服务的启动信息,但是启动脚本还是被怀疑的
PS:介绍onoffreset而已

Bydefault,theonandoffoptionsaffectonlyrunlevels2,3,4,and
5,whileresetaffectsalloftherunlevels.The--leveloptionmaybe
usedtospecifywhichrunlevelsareaffected.

默认的情况下,on和off选项只能在2.3.4,5级别下运行,而reset则在可以作用到所有的级别,--level选项可以确定那是一个级别能够起作用

Notethatforeveryservice,eachrunlevelhaseitherastartscriptor
astopscript.Whenswitchingrunlevels,initwillnotre-startan
already-startedservice,andwillnotre-stopaservicethatisnot
running.
注意对所有的服务,每一个级别要么有一个启动脚本,要么有一个停止脚本,当改变运行级别时,启动不会重新启动一个已经运行的服务,也不会重新停止一个没有运行的服务

chkconfigalsocanmanagexinetdscriptsviathemeansofxinetd.dcon-
figurationfiles.Notethatonlytheon,off,and--listcommandsare
supportedforxinetd.dservices.

chkconfig同样可以管理超级守护进程经由xinetd.d的设置文件含义,注意这里仅仅可以用on和off,并且--list命令也是支持xinetd.d服务的

OPTIONS
--levellevels
Specifiestherunlevelsanoperationshouldpertainto.Itis
givenasastringofnumbersfrom0to7.Forexample,--level
35specifiesrunlevels3and5.
确定相应的运行级别,这个可以用0到7,比如说--level35指的是运行级别是3和5


--addname

Thisoptionaddsanewserviceformanagementbychkconfig.
Whenanewserviceisadded,chkconfigensuresthattheservice
haseitherastartorakillentryineveryrunlevel.Ifany
runlevelismissingsuchanentry,chkconfigcreatestheappro-
priateentryasspecifiedbythedefaultvaluesintheinit
script.NotethatdefaultentriesinLSB-delimited’INITINFO’
sectionstakeprecedenceoverthedefaultrunlevelsinthe
initscript.
这个选项通过chkconfig给管理器增加一个服务的名字,当一个服务被添加的时候,chkconfig需要确定这个服务有一个开始入口或者结束入口在每一种运行级别。如果任何的一个运行级别缺少这样的入口,chkconfig会通过init脚本建立适合的入口,注意,在最低有效位界限“initinfo”模块中的默认入口,优先于init脚本的默认启动级别

--delname
Theserviceisremovedfromchkconfigmanagement,andanysym-
boliclinksin/etc/rc[0-6].dwhichpertaintoitareremoved.
服务被从chkconfig管理中移出,并且在/etc/rc[0-6].d中相应的符号行也会被移出

Notethatfuturepackageinstallsforthisservicemayrunchk-
config--add,whichwillre-addsuchlinks.Todisableaser-
vice,runchkconfignameoff.

--listname
Thisoptionlistsalloftheserviceswhichchkconfigknows
about,andwhethertheyarestoppedorstartedineachrunlevel.
Ifnameisspecified,informationinonlydisplayaboutservice
name.
这个选项会把所有的chkconfig认识的服务统统列出来,不管他是否被停止或者开始在任何运行级别,如果服务名字给出了,那么信息仅仅显示特定服务

RUNLEVELFILES
Eachservicewhichshouldbemanageablebychkconfigneedstwoormore
commentedlinesaddedtoitsinit.dscript.Thefirstlinetellschk-
configwhatrunlevelstheserviceshouldbestartedinbydefault,as
wellasthestartandstopprioritylevels.Iftheserviceshouldnot,
bydefault,bestartedinanyrunlevels,a-shouldbeusedinplaceof
therunlevelslist.Thesecondlinecontainsadescriptionforthe
service,andmaybeextendedacrossmultiplelineswithbackslashcon-
tinuation.

每一个能够被chkconfig管理的服务必须要有2行或者更多的注释添加到他的init.d脚本中,第一行告诉chkconfig服务的默认运行级别,还有运行级别的开始和结束的有限级,如果服务没有注明这些的话,那么可以在任意的级别运行,第2行是包括对于服务的描述,并且能够通过多重的反斜扛来扩充

Forexample,random.inithasthesethreelines:
#chkconfig:23452080
#description:Savesandrestoressystementropypoolfor\
#higherqualityrandomnumbergeneration.

Thissaysthattherandomscriptshouldbestartedinlevels2,3,4,
and5,thatitsstartpriorityshouldbe20,andthatitsstoppriority
shouldbe80.Youshouldbeabletofigureoutwhatthedescription
says;the\causesthelinetobecontinued.Theextraspaceinfront
ofthelineisignored.

这个是个例子无聊的时候可以看看

SEEALSO
init(8)ntsysv(8)system-config-services(8)

AUTHOR
ErikTroan

4thBerkeleyDistributionWedOct81997CHKCONFIG(8)

chkconfig---man (自己翻译的,有错误大家指出)chkconfig---man (自己翻译的,有错误大家指出)chkconfig---man (自己翻译的,有错误大家指出)chkconfig---man (自己翻译的,有错误大家指出)chkconfig---man (自己翻译的,有错误大家指出)chkconfig---man (自己翻译的,有错误大家指出)chkconfig---man (自己翻译的,有错误大家指出)chkconfig---man (自己翻译的,有错误大家指出)chkconfig---man (自己翻译的,有错误大家指出)chkconfig---man (自己翻译的,有错误大家指出)
阅读(429) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~