Systemd Restart =总是不被接受
注意:我在Medium上写了一篇文章,解释了如何创建服务以及如何避免这个特殊问题:使用systemd创建Linux服务。 原始问题: 我正在使用systemd使工作脚本始终保持工作状态: [Unit] Description=My worker After=mysqld.service [Service] Type=simple Restart=always ExecStart=/path/to/script [Install] WantedBy=multi-user.target 尽管如果脚本在几分钟后正常退出,则重新启动可以正常工作,但是我注意到,如果脚本在启动时反复执行失败,systemd将放弃尝试启动它: Jun 14 11:10:31 localhost systemd[1]: test.service: Main process exited, code=exited, status=1/FAILURE Jun 14 11:10:31 localhost systemd[1]: test.service: Unit entered failed state. Jun 14 11:10:31 localhost systemd[1]: test.service: Failed with result 'exit-code'. Jun 14 11:10:31 localhost systemd[1]: …