简体   繁体   English

通过systemd启动瓶子web服务器?

[英]Starting bottle web server through systemd?

I am trying to start a bottle web app I wrote using systemd. 我正在尝试启动我使用systemd编写的瓶子web应用程序。 I made the file /etc/systemd/user/bottle.service with the following contents: 我使用以下内容创建了文件/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

However, when I try to start it, it fails and this is printed in journalctl : 但是,当我尝试启动它时,它会失败,并在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.

How should I fix this? 我该怎么解决这个问题?

Edit: 编辑:

Changing to /usr/bin/python3 as others have suggested results in the same error (changed file though): 更改为/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.

I would have commented but I can't :/ 我会评论但我不能:/

Have you tried something like with an absolute path ? 你尝试过绝对路径吗?

ExecStart=/usr/bin/python3 /path/to/your/server.py

That's the only issue I can see here. 这是我在这里看到的唯一问题。

此错误的另一个可能原因是,如果您通过运行adduser --system创建了系统用户,并且尚未创建关联组。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM