From 15497c7d09db177d28787b332a6b61d908452713 Mon Sep 17 00:00:00 2001 From: localhorst Date: Wed, 2 Nov 2022 19:25:21 +0100 Subject: [PATCH] add systemd service file and install doc --- README.md | 20 +++++++++++++++++++- gas-station-exporter.service | 18 ++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 gas-station-exporter.service diff --git a/README.md b/README.md index 08963cc..d864533 100644 --- a/README.md +++ b/README.md @@ -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` diff --git a/gas-station-exporter.service b/gas-station-exporter.service new file mode 100644 index 0000000..c43b2a0 --- /dev/null +++ b/gas-station-exporter.service @@ -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