通过systemd启动瓶子Web服务器?
我正尝试开始使用systemd编写的瓶子web应用程序。 我使用以下内容创建了文件/etc/systemd/user/bottle.service
:
[Unit]
Description=Bottled fax service
After=syslog.target
[Service]
Type=simple
User=fax
Group=fax
WorkingDirectory=/home/fax/bottlefax/
ExecStart=/usr/bin/env python3 server.py
StandardOutput=syslog
StandardError=syslog
Restart=always
RestartSec=2
[Install]
WantedBy=bottle.target
但是,当我尝试启动它时,它会失败并将其打印在journalctl
:
Jun 10 17:33:31 nano systemd[1]: Started Bottled fax service.
Jun 10 17:33:31 nano systemd[1]: Starting Bottled fax service...
Jun 10 17:33:31 nano systemd[2380]: Failed at step GROUP spawning /usr/bin/env: No such process
Jun 10 17:33:31 nano systemd[1]: bottle.service: main process exited, code=exited, status=216/GROUP
Jun 10 17:33:31 nano systemd[1]: Unit bottle.service entered failed state.
Jun 10 17:33:31 nano systemd[1]: bottle.service failed.
我应该如何解决这个问题?
编辑:
更改为/usr/bin/python3
与其他人所提示的结果相同(但是已更改文件):
Jun 10 18:43:48 nano systemd[1]: Started Bottled fax service.
Jun 10 18:43:48 nano systemd[1]: Starting Bottled fax service...
Jun 10 18:43:48 nano systemd[2579]: Failed at step GROUP spawning /usr/bin/python3: No such process
Jun 10 18:43:48 nano systemd[1]: bottle.service: main process exited, code=exited, status=216/GROUP
Jun 10 18:43:48 nano systemd[1]: Unit bottle.service entered failed state.
Jun 10 18:43:48 nano systemd[1]: bottle.service failed.
我会评论,但我不能:/
你有没有尝试过像绝对路径的东西?
ExecStart=/usr/bin/python3 /path/to/your/server.py
这是我在这里可以看到的唯一问题。
导致此错误的另一个可能原因是,如果您通过运行adduser --system
创建了系统用户,并且尚未创建关联组。