1.5. Important [Service] section options


The following tables lists important options of the [Service] section.

Expand
表 1.3. Important [Service] section options
Option [a]Description

Type

Configures the unit process startup type that affects the functionality of ExecStart and related options. One of:

* simple - The default value. The process started with ExecStart is the main process of the service.

* forking - The process started with ExecStart spawns a child process that becomes the main process of the service. The parent process exits when the startup is complete.

* oneshot - This type is similar to simple, but the process exits before starting consequent units.

* dbus - This type is similar to simple, but consequent units are started only after the main process gains a D-Bus name.

* notify - This type is similar to simple, but consequent units are started only after a notification message is sent via the sd_notify() function.

* idle - similar to simple, the actual execution of the service binary is delayed until all jobs are finished, which avoids mixing the status output with shell output of services.

ExecStart

Specifies commands or scripts to be executed when the unit is started. ExecStartPre and ExecStartPost specify custom commands to be executed before and after ExecStart. Type=oneshot enables specifying multiple custom commands that are then executed sequentially.

ExecStop

Specifies commands or scripts to be executed when the unit is stopped.

ExecReload

Specifies commands or scripts to be executed when the unit is reloaded.

Restart

With this option enabled, the service is restarted after its process exits, with the exception of a clean stop by the systemctl command.

RemainAfterExit

If set to True, the service is considered active even when all its processes exited. Default is False. This option is especially useful if Type=oneshot is configured.

[a] For a complete list of options configurable in the [Service] section, see the systemd.service(5) manual page.
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2026 Red Hat
返回顶部