环境:以下命令仅适于redhat/centos,不适合于ubuntu.
先说共性吧:
chkconfig和service都可以作为服务启动,比如:
service postgresql start
或者
/etc/init.d/postgresql start
再说区别:
chkconfig除了可以启动服务外,还可以把服务添加到启动列表中。
所以可以狭窄的理解为:
service启动的服务在机器重启后将会失效。
而chkconfig添加的服务在机器重启后依然生效。
----------------------------------------------------------------------------------------------------------------
顺便说一下chkconfig如何把postgresql添加到自启动列表,(背景:postgresql是用yum安装的)
1、用root登录
1、cd /etc/init.d/
2、chkconfig --add postgresql9.1
3、可以用chkconfig --list来查看启动列表
4、添加好以后就可以利用service postgresql9.1 start/stop/restart来控制它了。
refurl:http://www.cnblogs.com/mchina/archive/2012/06/06/2539003.html