Ubuntu 16中的SystemD python任务

时间:2017-03-07 18:28:05

标签: python python-3.x ubuntu ubuntu-16.04 systemd

我正在尝试在ubuntu 16中使用systemd执行python3。 以下是配置

[Unit]
Description=email notification server
After=multi-user.target

[Service]
WorkingDirectory=/home/ubuntu/email-noti
Restart=on-failure
ExecStart=/usr/lib/python3 /home/ubuntu/email-noti/email_reader.py 

[Install]
WantedBy=multi-user.target

*请注意email_reader.py/home/ubuntu/email-noti/

导入配置文件和少量python3文件

但它始终以跟随错误结束

● email-noti.service - email notification server
   Loaded: loaded (/etc/systemd/system/email-noti.service; enabled; vendor preset: enabled)
   Active: inactive (dead) (Result: exit-code) since Tue 2017-03-07 18:00:38 UTC; 6s ago
  Process: 11859 ExecStart=/usr/lib/python3 /home/ubuntu/email-noti/email_reader.py (code=exited, status=203/EXEC)
 Main PID: 11859 (code=exited, status=203/EXEC)

Mar 07 18:00:38 ip-172-31-24-115 systemd[1]: email-noti.service: Service hold-off time over, scheduling restart.
Mar 07 18:00:38 ip-172-31-24-115 systemd[1]: Stopped email notification server.
Mar 07 18:00:38 ip-172-31-24-115 systemd[1]: email-noti.service: Start request repeated too quickly.
Mar 07 18:00:38 ip-172-31-24-115 systemd[1]: Failed to start email notification server.

但是当我手动执行email_reader.py完全正常时。

任何帮助表示赞赏

0 个答案:

没有答案