如何在 /etc/rc0.d 中确定和应用优先级

如何在 /etc/rc0.d 中确定和应用优先级

我有脚本“backup-before-shutdown”,它应该在关机前运行!所以我在“/etc/rc0.d”中创建了它的链接,我只想知道我应该添加一些优先级(K、S 或一些数字)还是只保留该目录中的此链接即可(因为这是生产环境,我无法进行测试)如果我必须添加优先级,如何决定它以及如何应用它?将文件重命名为 K35backup-before-shutdown 是否足够?

$ ll

total 12
drwxr-xr-x   2 root root 4096 Nov 16 10:06 ./
drwxr-xr-x 100 root root 4096 Nov  6 16:23 ../
lrwxrwxrwx   1 root root   34 Nov 16 10:06 backup-before-shutdown -> /etc/init.d/backup-before-shutdown*
lrwxrwxrwx   1 root root   17 Feb 16  2015 K08tomcat7 -> ../init.d/tomcat7*
lrwxrwxrwx   1 root root   17 Apr 17  2015 K09apache2 -> ../init.d/apache2*
lrwxrwxrwx   1 root root   29 Sep 27  2014 K10unattended-upgrades -> ../init.d/unattended-upgrades*
lrwxrwxrwx   1 root root   26 Sep 27  2014 K15landscape-client -> ../init.d/landscape-client*
lrwxrwxrwx   1 root root   15 Sep 27  2014 K20rsync -> ../init.d/rsync*
lrwxrwxrwx   1 root root   24 Sep 27  2014 K20screen-cleanup -> ../init.d/screen-cleanup*
lrwxrwxrwx   1 root root   23 Sep 27  2014 K38open-vm-tools -> ../init.d/open-vm-tools*
-rw-r--r--   1 root root  351 Mar 13  2014 README
lrwxrwxrwx   1 root root   18 Sep 27  2014 S20sendsigs -> ../init.d/sendsigs*
lrwxrwxrwx   1 root root   17 Sep 27  2014 S30urandom -> ../init.d/urandom*
lrwxrwxrwx   1 root root   22 Sep 27  2014 S31umountnfs.sh -> ../init.d/umountnfs.sh*
lrwxrwxrwx   1 root root   18 Sep 27  2014 S40umountfs -> ../init.d/umountfs*
lrwxrwxrwx   1 root root   26 Sep 27  2014 S59cryptdisks-early -> ../init.d/cryptdisks-early*
lrwxrwxrwx   1 root root   20 Sep 27  2014 S60umountroot -> ../init.d/umountroot*
lrwxrwxrwx   1 root root   16 Sep 27  2014 S90reboot -> ../init.d/reboot*

答案1

你应该读一读man update-rc.d。名字是有系统的,如果你学会了它,而不是自己想出一个名字,你的生活会更幸福。另请阅读man run-parts

man update-rc.d

DESCRIPTION

       update-rc.d  updates   the   System   V   style   init   script   links
       /etc/rcrunlevel.d/NNname  whose  target is the script /etc/init.d/name.
       These links are run  by  init  when  it  changes  runlevels;  they  are
       generally  used  to  start  and  stop  system services such as daemons.
       runlevel  is  one  of  the  runlevels  supported   by   init,   namely,
       0123456789S,  and  NN  is the two-digit sequence number that determines
       where in the sequence init will run the scripts.

       This manpage documents only the usage  and  behaviour  of  update-rc.d.
       For  a discussion of the System V style init script arrangements please
       see init(8) and the Debian Policy Manual.

相关内容