I have a below service file:
[Unit]
Description=demo service
Requisite=mosquitto.service
BindsTo=mosquitto.service
[Service]
Type=simple
ExecStart=/usr/bin/python3 /home/john/Documents/source/demo.py
Restart=on-failure
RestartSec=30s
StandardOutput=null
[Install]
WantedBy=multi-user.target
This demo.service
simply calls a python code demo.py
. When I am starting the service using sudo systemctl start demo.service
, it always remains in auto-restart(failure)
mode.
demo.service - demo service
Loaded: loaded (/etc/systemd/system/demo.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Mon 2020-08-17 12:13:37 BST; 23s ago
Process: 4744 ExecStart=/usr/bin/python3 /home/john/Documents/source/demo.py
Main PID: 4744 (code=exited, status=1/FAILURE)
I have checked syslog
but there is no useful information in them. It just shows demo service started and demo service stopped logs.
From where can I get its logs to understand why the service is not starting. Please help. Thanks
Below are the logs from journactl
:
Aug 13 13:51:40 john systemd[1]: Started demo service.
Aug 13 13:51:40 john systemd[1]: demo.service: Main process exited, code=exited, status=1/FAILURE
Aug 13 13:51:40 john systemd[1]: demo.service: Failed with result 'exit-code'.
Aug 13 13:52:10 john systemd[1]: demo.service: Service hold-off time over, scheduling restart.
Aug 13 13:52:10 john systemd[1]: demo.service: Scheduled restart job, restart counter is at 2.
Aug 13 13:52:10 john systemd[1]: Stopped demo service.