add systemd service file and install doc

This commit is contained in:
Hendrik Schutter 2022-11-02 19:25:21 +01:00
parent 22fafbd097
commit 15497c7d09
2 changed files with 37 additions and 1 deletions

View File

@ -4,7 +4,7 @@ Scrapes gas prices from [https://clever-tanken.de](clever-tanken.de ) and export
## Requirements
`pip install lxml beautifulsoup4`
`pip install lxml beautifulsoup4 unidecode`
## Config
@ -54,3 +54,21 @@ gas_AVIA_Hauptstr73_77761_Schiltach_SuperPlus 2.009
gas_AVIA_Hauptstr73_77761_Schiltach_LPG 1.099
```
## Permanent Install
`cd /usr/bin/`
`git clone https://git.mosad.xyz/localhorst/gas-station-exporter.git`
`cd gas-station-exporter.git`
Change host and port in `gas-station-exporter.py`
`mv gas-station-exporter.service /usr/lib/systemd/system/`
`systemctl daemon-reload`
`systemctl enable --now /usr/lib/systemd/system/gas-station-exporter.service`
`systemctl status gas-station-exporter.service`

View File

@ -0,0 +1,18 @@
[Unit]
Description=Prometheus gas station exporter for fuel prices
Documentation=https://git.mosad.xyz/localhorst/gas-station-exporter
Wants=network-online.target
After=network-online.target
After=wg-quick@wg0.service
[Service]
Restart=always
User=prometheus
WorkingDirectory=/usr/bin/gas-station-exporter/
ExecStart=/usr/bin/python3 gas-station-exporter.py
ExecReload=/bin/kill -HUP $MAINPID
TimeoutStopSec=20s
SendSIGKILL=no
[Install]
WantedBy=multi-user.target