我想用我的Django项目使用uwsgi
我测试usgi --ini uwsgi.ini
效果很好
而我想写进去systemd
控制它
面对错误
这是我的文件
/etc/systemd/system/mysite.service
[Unit]
Description=uWSGI for proj
After=syslog.target
[Service]
Restart=always
ExecStart=/usr/bin/uwsgi --ini /usr/share/nginx/ENV/proj/proj/uwsgi.ini
StandardError=syslog
KillSignal=SIGQUIT
Type=forking
NotifyAccess=main
[Install]
WantedBy=multi-user.target
Run Code Online (Sandbox Code Playgroud)
我第一次使用systemctl restart mysite.service
它效果很好,然后我使用systemctl stop mysite.service
然后重新启动systemctl restart mysite.service
但是停止后它无法重新启动
我收到错误:
proj.service - uWSGI for proj
Loaded: loaded (/usr/lib/systemd/system/proj.service; disabled)
Active: failed (Result: start-limit) since Fri 2015-11-13 13:40:35 CST; 887ms ago
Process: 4297 ExecStart=/usr/bin/uwsgi --ini /usr/share/nginx/ENV/proj/proj/uwsgi.ini (code=exited, status=0/SUCCESS)
Main PID: 4298 (code=exited, status=0/SUCCESS)
Nov 13 13:40:35 localhost.localdomain systemd[1]: proj.service …
Run Code Online (Sandbox Code Playgroud) 我在嵌入式系统中使用 systemd 231,并且我正在尝试创建一个服务来监视系统中的硬件组件。这是我正在尝试做的事情的粗略描述:
foo.service
启动时,它会启动一个应用程序foo_app
。foo_app
监控硬件组件,持续运行。foo_app
检测到硬件故障,它会以返回码 1 退出。这应该会触发系统重新启动。foo_app
崩溃,systemd 应该重新启动foo_app
。foo_app
反复崩溃,systemd 应该重新启动系统。这是我将其实现为服务的尝试:
[Unit]
Description=Foo Hardware Monitor
# If the application fails 3 times in 30 seconds, something has gone wrong,
# and the state of the hardware can't be guaranteed. Reboot the system here.
StartLimitBurst=3
StartLimitIntervalSec=30
StartLimitAction=reboot
# StartLimitAction=reboot will reboot the box if the app fails repeatedly,
# but if the app exits …
Run Code Online (Sandbox Code Playgroud)