今天在安装redis的时候, make && make install之后还需要执行util/install_server.sh这个脚本, 但是执行的过程中提示“update-rc.d” command not found。 我找到脚本中的相应的行, 这样调用的update-rc.d defaults。
搜google大仙:
摘自:
这个update-rc.d跟redhat系里面的chkconfig作用一样, 把/etc/init.d目录下的某个服务起停脚本加到系统的runlevel中去。
提问: Community,
in Debian based distributions, one can easily manage init-scripts, i.e. placing links from /etc/init.d/ to /etc/rc(0..6).d/ directories respectively removing them (to enable/disable services in appropriate runlevels) with a script called "update-rc.d". Is there an equivalent for openSUSE available?
In Debian based distributions it works like that:
update-rc.d defaults
to create the appropriate links in /etc/rc(0..6).d/ and
update-rc.d -f remove
to remove them.
Obviously these commands are just the basics, but I think you got the idea. Thanks!
回答:
1. In openSUSE you use /etc/init.d/skeleton to make a new script in /etc/init.d/. This skeleton contains special comments (they are comments for the shell, but used by YaST) to describe on which runlevels the start/stop must be.
Once done, the script will show in YaST > System > System Services (runlevel) and can be switched on/off from there (making the links, etc).
2. In SUSE it isn't done that way. One common mistake for users coming from Redhat or Debian based distros is to try to create/delete the links from /etc/init.d to /etc/rcN.d, either manually or via a program such as update-rc.d.
SUSE uses the metadata in the comments at the top of the file to manage the links and the correct sequencing. To enable a service you use chkconfig, as in:
chkconfig --set someservice on
or
chkconfig --set someservice off
and the appropriate links will be created/deleted. For finer control over levels, you can use
chkconfig --level 35 someservice on
like in Redhat. In SUSE you don't have to worry about the sequence number, because the system will work it out from the dependencies. That is why you see the numbers clustered nearer 00 than Redhat systems.
Of course, non-power users would use YaST, which calls chkconfig, to manage the services.
阅读(4544) | 评论(0) | 转发(0) |