Systemd 服务,我想创建但它失败了。这是我创建的服务。
[Unit]
Description=rqworker daemon
After=network.target
[Service]
Type=simple
WorkingDirectory=/home/ubuntu/mamster
User=ubuntu
Group=ubuntu
#EnvironmentFile=/etc/sysconfig/master.env
#Environment="PYTHONPATH=/home/ubuntu/venv"
ExecStart=/home/ubuntu/venv /venv/bin/rqworker master
StandardOutput=/home/ubuntu/logs/icengine/std_out.log
StandardError=/home/ubuntu/logs/icengine/std_err/log
#SyslogIdentifier=icengin
KillMode=process
Restart=always
TimeoutSec=infinity
RestartPreventExitStatus=255
Type=notify
[Install]
WantedBy=multi-user.target
Alias=master.service
最初这项服务是Actiating(Start)
但不是Active
但是在我做了一些更改之后,现在它显示错误:
运行后sudo systemctl start rq
(venv) ubuntu@ubuntucalc:~$ sudo systemctl status rq
● rq.service - rqworker daemon
Loaded: loaded (/etc/systemd/system/rq.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2019-01-15 06:53:20 UTC; 4s ago
Process: 18537 ExecStart=/home/ubuntu/venv /venv/bin/rqworker master (code=exited, status=200/CHDIR)
Main PID: 18537 (code=exited, status=200/CHDIR)
Jan 15 06:53:20 ubuntucalc systemd[1]: rq.service: Main process exited, code=exited, status=200/CHDIR
Jan 15 06:53:20 ubuntucalc systemd[1]: rq.service: Failed with result 'exit-code'.
Jan 15 06:53:20 ubuntucalc systemd[1]: Failed to start rqworker daemon.
Jan 15 06:53:20 ubuntucalc systemd[1]: rq.service: Service hold-off time over, scheduling restart.
Jan 15 06:53:20 ubuntucalc systemd[1]: rq.service: Scheduled restart job, restart counter is at 5.
Jan 15 06:53:20 ubuntucalc systemd[1]: Stopped rqworker daemon.
Jan 15 06:53:20 ubuntucalc systemd[1]: rq.service: Start request repeated too quickly.
Jan 15 06:53:20 ubuntucalc systemd[1]: rq.service: Failed with result 'exit-code'.
Jan 15 06:53:20 ubuntucalc systemd[1]: Failed to start rqworker daemon.
这是我得到的输出。谢谢