about systemd service definition
Hi, i am a new user. I dont know how to set tesla-apiscraper for auto start after debian boot. I hope someone can help me. Thanks. I had test set a systemd service but it show Error
root@Debian:~# sudo systemctl status tesla.service
- tesla.service - Tesla Service Loaded: loaded (/lib/systemd/system/tesla.service; enabled; vendor preset: en Active: failed (Result: exit-code) since Fri 2019-09-13 06:09:06 UTC; 29s ago Process: 1174 ExecStart=/usr/bin/python3 apiscraper.py (code=exited, status=1/ Main PID: 1174 (code=exited, status=1/FAILURE)
Sep 13 06:09:05 Debian systemd[1]: Started Tesla Service. Sep 13 06:09:06 Debian python3[1174]: Failed to initialize Owner API Sep 13 06:09:06 Debian systemd[1]: tesla.service: Main process exited, code=exit Sep 13 06:09:06 Debian systemd[1]: tesla.service: Unit entered failed state. Sep 13 06:09:06 Debian systemd[1]: tesla.service: Failed with result 'exit-code' lines 1-11/11 (END)
my service is:
[Unit] Description=Tesla Service After=multi-user.target
[Service] Type=idle WorkingDirectory=/tesla-apiscraper ExecStart=/usr/bin/python3 apiscraper.py
[Install] WantedBy=multi-user.target
Does the Service work if you start it manually?
This one works for me on a debian based distro (armbian):
[Unit]
Description=Tesla Api Scraper
After=network.target
[Service]
Type=simple
User=bananapi
Group=bananapi
ExecStart=python3 /home/bananapi/tesla-apiscraper/apiscraper.py
Restart=always
Users=bananapi
WorkingDirectory=/home/bananapi/tesla-apiscraper
StandardOutput=syslog
StandardError=syslog
[Install]
WantedBy=multi-user.target
Be careful to start it AFTER influxdb has started or it will exit immediately.