For*_*inn 5 systemd services systemd-unit
我有一个由大约 15 个服务组成的系统。它们没有相互依赖性(即没有服务需要另一个服务来启动),并且它们在启动完成时通知 systemd(即Type=notify)。
问题是,如果我同时启动它们,我的系统就会过载,并且进程会由于 systemd 超时而被终止。
我想要做的是将我的服务“分组”,以便它们一个接一个地启动,没有特定的顺序。这可以通过 systemd 服务文件实现吗?
顺便说一句:这是我的服务文件的模板:
[Unit]
Description=Template service file
After=network.target
[Service]
Type=notify
User=1000
Group=1000
# Set the working directory and the binary to start
WorkingDirectory=/home/user/
ExecStart=/path/to/some/process
# The standard input and output are useless (i.e. unused by the process)
StandardInput=null
StandardOutput=null
# Disable the standard error because all logs are already saved in a specific directory
StandardError=null
# Send SIGTERM then SIGKILL after TimeoutStopSec seconds (default: 2)
KillMode=mixed
TimeoutStopSec=2
# Setup a start timeout
TimeoutStartSec=30
# On abnormal (i.e. non 0 exit code or killed by a signal) termination restart the process after RestartSec seconds (default: 5)
Restart=on-failure
RestartSec=5
# Authorise process restart only 5 times maximum in a 120 seconds interval
StartLimitBurst=5
StartLimitInterval=120
# Set watchdog timeout (default: 10)
WatchdogSec=10
NotifyAccess=main
# Set security options
NoNewPrivileges=yes
[Install]
WantedBy=custom.target
Run Code Online (Sandbox Code Playgroud)
感谢您的帮助
| 归档时间: |
|
| 查看次数: |
868 次 |
| 最近记录: |