文章摘要
这篇文章介绍了`/etc/rc.local`服务文件在`systemd`中的配置内容。该文件被系统自动安装到多用户环境中,并由`systemd-rc-local-generator`服务启动。文件内容包括许可证信息(基于LGPL-2.1或更高版本)、服务启动方式(forking类型,启动脚本为`/etc/rc.local start`,不设置时间限制,并在服务退出后继续运行),以及服务的依赖关系(由`multi-user.target`服务安装)。文章重点描述了`/etc/rc.local`的结构和功能,适合需要配置自动服务启动的用户参考。
# SPDX-License-Identifier: LGPL-2.1+
#
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# This unit gets pulled automatically into multi-user.target by
# systemd-rc-local-generator if /etc/rc.local is executable.
[Unit]
Description=/etc/rc.local Compatibility
Documentation=man:systemd-rc-local-generator(8)
ConditionFileIsExecutable=/etc/rc.local
After=network.target
[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
RemainAfterExit=yes
GuessMainPID=no
[Install]
WantedBy=multi-user.target
© 版权声明
文章版权归作者所有,未经允许请勿转载。