som*_*ing 6 debian systemd services start-stop-daemon
我正在学习如何使用 systemd 创建服务。我收到此错误:
.service: Start request repeated too quickly.
Run Code Online (Sandbox Code Playgroud)
我无法再启动服务;它昨天正在工作。我究竟做错了什么?
(root@Kundrum)-(11:03:19)-(~)
$nano /lib/systemd/system/swatchWATCH.service
1 [Unit]
2 Description=Monitor Logfiles and send Mail reports
3 After=syslog.target network.target
4
5 [Service]
6 Type=simple
7 ExecStart=/usr/bin/swatch --config-file=/home/kristjan/.swatchrc --input-record-separator="\n \n " --tail-file=/var/log/snort/alert --daemon
8 Restart=on-failure
9 StartLimitInterval=3
10 StartLimitBurst=100
11
12 [Install]
13 WantedBy=multi-user.target
Run Code Online (Sandbox Code Playgroud)
StartLimitInterval而StartLimitBurst我试图修复它之后添加。
我的系统是 Debian 9.8 Stretch 所有更新。
“systemd[1]:SERVICE:启动请求重复得太快”的快速解决方案是
systemctl reset-failed SERVICE
systemctl start SERVICE
systemctl status SERVICE
Run Code Online (Sandbox Code Playgroud)
man systemctl的相关引用:
重置失败 [模式...]
...启动速率限制计数器重置为零。因此,如果达到某个单元的启动限制(如配置
StartLimitIntervalSec=/StartLimitBurst=)并且该单元拒绝再次启动,请使用此命令使其可以再次启动。”
首先,如果这是一个自定义服务,它属于/etc/systemd/system. /lib/systemd用于包提供的文件。
其次,该服务可能会崩溃并且 systemd 会尝试反复重新启动它,因此您需要找出它崩溃的原因。检查服务日志:
journalctl -e -u swatchWATCH
Run Code Online (Sandbox Code Playgroud)
主期刊中可能会有一些额外的细节:
journalctl -e
Run Code Online (Sandbox Code Playgroud)
最后,查看它是否直接在 CLI 上运行 ok:
/usr/bin/swatch --config-file=/home/kristjan/.swatchrc --input-record-separator="\n \n " --tail-file=/var/log/snort/alert --daemon
我看你使用的是--daemon选项。这就是通常与systemd一个错误。Systemd daemonizes你。尝试删除此选项。
如果所有其他方法都失败了,请查看自昨天起运行时发生了什么变化。