将脚本的符号链接添加到rc..d文件夹中以在系统启动期间启动进程 [英] Adding symlink to scripts into rc<number>.d folders to start process during system startup

查看:246
本文介绍了将脚本的符号链接添加到rc..d文件夹中以在系统启动期间启动进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用fedora 15.

I am using fedora 15.

我正在尝试添加MYSql守护程序以在系统启动期间启动.

I am trying to add MYSql daemon to start during system strtup.

我了解我将必须将其添加到rc5.d中,因为它是默认目标&是graphical.target.

I have understood that I will have to add it to rc5.d as it is the default target & is graphical.target.

来自inittab:

systemd使用目标"而不是运行级别.默认情况下,有两个主要目标:

systemd uses 'targets' instead of runlevels. By default, there are two main targets:

multi-user.target:类似于运行级别3
graphic.target:类似于运行级别5

multi-user.target: analogous to runlevel 3
graphical.target: analogous to runlevel 5

来自服务,运行级别和rc.d脚本的简介:

当系统关闭时,/etc/rc0.d和/etc/rc6.d目录中还有另一个符号链接(分别是halt和reboot),该符号链接以K开头而不是S开头,它告诉init关闭进程.

When the system is shut down, there is another symlink in the /etc/rc0.d and /etc/rc6.d directories (halt and reboot, respectively) that starts with a K instead of an S, which tells init to shut down the process.

我注意到所有rc<number>.d文件夹中都存在指向httpd的符号链接 作为符号链接: K15httpd -> ../init.d/httpd . 没有以 S 开头的符号链接.很有意义,因为我必须手动启动它.

I notice that symlink to httpd are present in all the rc<number>.d folders as symlink: K15httpd -> ../init.d/httpd. No symlink is present that starts with S. Makes sense as I have to start it manually.

  • 为什么在所有 rc<number>.d 文件夹中都存在符号链接 K15httpd -> ../init.d/httpd ?

  • 如果要在系统启动过程中启动 httpd ,我应该给符号链接命名吗?

  • 符号链接中显示的数字是多少?即 K15httpd-> ../init.d/httpd 这里的 15 是什么?

  • 我阅读了(此处),指向 MYSql 的符号链接应为 S98mysql 正确,以 K开头的符号链接的名称应该是什么? 应该是?
  • Why is the symlink K15httpd -> ../init.d/httpd present in all the rc<number>.d folders?

  • What should I name the symlink if I want to start httpd during system startup?

  • What is the number that is present in the symlink? i.e. K15httpd -> ../init.d/httpd what is 15 here?

  • I read (here) that the symlink to MYSql should be S98mysql is it right and what should the name to symlink that starts with K should be?

推荐答案

对于/etc/init.d

  • 启动脚本S##<base script name>
  • 杀死脚本K##<base script name>
  • Start scripts S##<base script name>
  • Kill scripts K##<base script name>

##表示运行级别控制脚本运行期间脚本执行的顺序.脚本的执行顺序为:

The ## represent the order in which the script will be executed during the run of runlevel control script. The order in which the scripts are executed is:

  • 杀死脚本
  • 启动脚本

它将执行的顺序与以下输出中文件的顺序相同:

The order in which it will be execute is the same as the order of files in the output of:

`ls /etc/rc#.d/K*`
`ls /etc/rc#.d/S*`

因此,通过此标记,K15httpd脚本的存在意味着在您的情况下,在此运行级别5,应该停止apache(或另一个Web服务).

So by this token the existence of K15httpd script implies that at this runlevel in your case 5 the apache(or another web service) should be stopped.

出于同样的原因,MySQL的杀死脚本位于较低级别,而您在其中启动的脚本将是K02MySQL.

By same token the kill script for MySQL in lower levels then the one you start it in would be K02MySQL.

您可以查看

You can look at this link to read about the writing the System V init scripts.

这篇关于将脚本的符号链接添加到rc..d文件夹中以在系统启动期间启动进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆