【问题标题】:Starting bottle web server through systemd?通过systemd启动bottle web服务器?
【发布时间】:2015-08-26 03:11:36
【问题描述】:

我正在尝试启动我使用 systemd 编写的瓶子网络应用程序。我用以下内容制作了文件/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.

【问题讨论】:

  • 您确定/usr/bin/env 是您想要的吗? /usr/bin/python3 怎么样?

标签: python python-3.x bottle systemd


【解决方案1】:

我会发表评论,但我不能:/

您是否尝试过使用绝对路径之类的方法?

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

这是我在这里看到的唯一问题。

【讨论】:

    【解决方案2】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-01
      • 2017-06-24
      • 2022-07-08
      • 2021-01-08
      相关资源
      最近更新 更多