我正在学习如何使用systemd创建服务。我知道这个错误:
.service: Start request repeated too quickly.
我不能再开始这项服务了,它昨天就开始工作了。我做错了什么?
(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
StartLimitInterval
和StartLimitBurst
是在试图修复它之后添加的。
我的系统是Debian9.8,扩展所有更新。
发布于 2019-05-08 17:10:54
首先,如果这是一个自定义服务,那么它属于/etc/systemd/system
。/lib/systemd
适用于包提供的文件.
其次,服务很可能崩溃,而systemd试图多次重新启动它,因此您需要弄清楚它崩溃的原因。使用以下方法检查服务日志:
journalctl -e -u swatchWATCH
在主要期刊上可能会有一些额外的细节:
journalctl -e
最后,检查它是否直接在CLI上运行:
/usr/bin/swatch -config-file=/home/kristjan/.swatch var输入-记录分隔符=“n \n”-尾文件=/var/log/snort/警报-守护进程
我看到你在使用--daemon
选项。这通常是systemd的一个错误。Systemd为您提供后台服务。尝试删除此选项。
如果所有这些都失败了,请回顾一下自昨天开始工作以来所发生的变化。
发布于 2021-06-14 15:30:01
"systemd1:SERVICE: Start request“的快速解决方案是
systemctl reset-failed SERVICE
systemctl start SERVICE
systemctl status SERVICE
man systemctl的相关引文:
重置-失败的图案... .启动速率限制计数器被重置为零。因此,如果一个单元的开始限制(使用
StartLimitIntervalSec=/StartLimitBurst=
配置)被击中,并且该单元拒绝再次启动,请使用此命令使其再次启动。“
发布于 2021-10-07 12:38:20
在我的例子中,错误信息有点误导人。故障的原因是由机器之间的副本造成的。线
User=my_user
在我的服务配置文件中,/etc/systemd/system/infinite_script.service
是罪魁祸首。
这台新机器不知道这个用户。改为User=root
解决了这个问题。
https://unix.stackexchange.com/questions/517759
复制相似问题