Systemd service, I want to create but it fails. This is my service i have created.
[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
Initially this service is Actiating(Start)
but was not Active
But after i made some changes and now it showing error:
After running 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.
This is the output i have got. Thanks
There are some issues in that unit file:
Type=
, one withsimple
and one withnotify
. It must contain only one such line and that must be of the proper type which in turn depends on how the executable/home/ubuntu/venv
behaves. For daemons, oftenforking
is used.StandardError
should presumably be/home/ubuntu/logs/icengine/std_err.log
and not/home/ubuntu/logs/icengine/std_err/log
. Make sure the userubuntu
is able to write to that location and the directories exist. I reckonsystemd
won't create the path if it doesn't exist (although it'll create the file).StandardOutput=
andStandardError=
is wrong. According to the docs the sysntax isStandardOutput=file:/home/ubuntu/logs/icengine/std_out.log
. Same forStandardError
.