系统:ubuntu 18.04
systemd 服务中,使用Requisite 定义依赖关系,被依赖服务未启动,但是当前单元的服务却成功启动
flask_app.service
[Unit]
Description=python web service(using gunicorn WSGI)
After=syslog.target network.target
Requisite=mysql.service
[Service]
Type=simple
PIDFile=/data/project/xhxf/log/flask_app.pid
WorkingDirectory=/data/project/xhxf/
ExecStart=/usr/bin/gunicorn -b localhost:7071 app:app
[Install]
WantedBy=multi-user.target
执行了以下命令
systemctl daemon-reload
systemctl start flask_app.service
运行结果:
mysql 是未启动状态,日志内也会有显示当前服务未活跃
flask_app.service 却成功启动
按照官方文档说
However, if the units listed here are not started already, they will not be started and the starting of this unit will fail immediately
如果这里列出的单元尚未启动,则它们将不会启动,该单元的启动将立即失败。
实践和理论不匹配。想知道是哪里不对吗
Requires
单词拼错了