Show Table of Contents
F.2.5. 任务定义
之前,sysvinit 软件包为默认配置提供 init 守护进程。当系统启动时,这个 init 守护进程运行
/etc/inittab 脚本启动为每个运行级别定义的系统进程。默认配置现在使用事件驱动的由 Upstart 软件包提供的 init 守护进程。每当有特定的事件发生时,init 守护进程都会执行 /etc/event.d 目录中保存的作业。init 守护进程也将系统的启动作为这样的一个事件。
每个作业通常都会指定一个程序以及激发 init 运行或者停止该程序的事件。有些作业是由任务组成,这些任务执行动作,然后直到另一个事件激发该作业时终止动作。其他作业由服务组成,init 可保持其运行直到另一个事件(或者用户)停止它。
例如:
/etc/events.d/tty2 作业是一个在 tty2 中从系统启动直到关闭为止,或者另一个事件(比如运行级别的改变)停止该作业时,维护虚拟终端的服务。该作业由服务组成,因此如果在此期间它意外停止,init 将重启虚拟终端:
# tty2 - getty # # This service maintains a getty on tty2 from the point the system is # started until it is shut down again. start on stopped rc2 start on stopped rc3 start on stopped rc4 start on started prefdm stop on runlevel 0 stop on runlevel 1 stop on runlevel 6 respawn exec /sbin/mingetty tty2

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.