linux init.d_什么是init.d以及如何在Linux中用于服务管理

linux init.d

linux init.d

Linux operating systems generally uses boot loader like grub and lilo and than uses init process to start operating system and other services.init is the most important process which forks or creates other process in a Linux system. init.d is init  configuration directory which holds information about the services or daemons.

Linux操作系统通常使用grublilo类的引导加载程序,而不是使用init进程来启动操作系统和其他服务。 init是在Linux系统中派生或创建其他进程的最重要进程。 init.dinit配置目录,其中包含有关服务或守护程序的信息。

init.d位置 (init.d Location)

init.d is located under /etc which is configuration directory for most of the Linux distributions. We can chech the existence of the init.d with the file command like below. It is a directory of course.

init.d位于/etc ,该目录是大多数Linux发行版的配置目录。 我们可以使用以下file命令检查init.d的存在。 这是一个目录。

$ file /etc/init.d
init.d Location
init.d Location
init.d位置

初始化守护进程(Init Daemon)

init daemon is the first process of Linux system. Then other processes, services, daemons and threats are started by init . So init.d is a configuration database for init process.

init守护程序是Linux系统的第一步。 然后,其他进程,服务,守护程序和威胁由init启动。 因此, init.d是用于init进程的配置数据库。

守护程序脚本 (Daemon Script)

Now we will print an example daemon process. A daemon script will hold functions like start , stop , restart ,status etc. We will use cron daemon script in this example.

现在,我们将打印一个示例守护进程。 守护程序脚本将包含startstoprestartstatus等功能。在本示例中,我们将使用cron守护程序脚本。

$ cat /etc/init.d/cron
Daemon Script
Daemon Script
守护程序脚本

列出Init.d目录(List Init.d Contents)

There are a lot of different daemon and service scripts in init.d directory. We can list these scripts with the ls command like below.

init.d目录中有很多不同的守护程序和服务脚本。 我们可以使用ls命令列出这些脚本,如下所示。

$ ls /etc/init.d/
List Init.d Contents
List Init.d Contents
列出Init.d目录

Init.d脚本用法(Init.d Script Usage)

We can use these daemon scripts just by calling the like a regular bash script. Lets print some help information by calling script but not providing any option.

我们可以像调用常规bash脚本一样使用这些守护程序脚本。 让我们通过调用脚本但不提供任何选项来打印一些帮助信息。

$ /etc/init.d/cron

and then list the status of the cron daemon which is used for scheduled jobs.

然后列出用于计划作业的cron守护程序的状态。

$ /etc/init.d/cron status
Init.d Script Usage
Init.d Script Usage
Init.d脚本用法
LEARN MORE  How To Restart CentOS, Fedora, RedHat?
了解更多如何重启CentOS,Fedora,RedHat?

翻译自: https://www.poftut.com/what-is-init-d-and-how-to-use-for-service-management-in-linux/

linux init.d

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值