diff options
| author | Dmitry Ilvokhin <d@ilvokhin.com> | 2026-02-07 17:47:16 +0000 |
|---|---|---|
| committer | Dmitry Ilvokhin <d@ilvokhin.com> | 2026-02-07 21:19:50 +0000 |
| commit | dfff28513622f659430ef064322cfa701513feb0 (patch) | |
| tree | 2c9457db3635c3ee1f748ba5d21c5ba8e8538109 /roles/flatbot/files | |
| parent | f34ef9c98c3b24d170d178f381aaf8ed50b1c729 (diff) | |
| download | infra-dfff28513622f659430ef064322cfa701513feb0.tar.gz infra-dfff28513622f659430ef064322cfa701513feb0.tar.bz2 infra-dfff28513622f659430ef064322cfa701513feb0.zip | |
Add run-flatbot wrapper script
Goal is to keep all URLs in one place (file), because I forget to modify
multiple files, when make changes.
Diffstat (limited to 'roles/flatbot/files')
| -rw-r--r-- | roles/flatbot/files/config | 1 | ||||
| -rw-r--r-- | roles/flatbot/files/flatbot.service | 3 | ||||
| -rwxr-xr-x | roles/flatbot/files/run-flatbot | 27 | ||||
| -rw-r--r-- | roles/flatbot/files/urls | 7 |
4 files changed, 34 insertions, 4 deletions
diff --git a/roles/flatbot/files/config b/roles/flatbot/files/config index 80983bb..ca71055 100644 --- a/roles/flatbot/files/config +++ b/roles/flatbot/files/config @@ -1,2 +1,3 @@ FLATBOT_TELEGRAM_CHAT_ID=-1001856540467 FLATBOT_STATE=/var/lib/flatbot/state.json +FLATBOT_URLS=/etc/flatbot/urls diff --git a/roles/flatbot/files/flatbot.service b/roles/flatbot/files/flatbot.service index 1dd6028..3b669d7 100644 --- a/roles/flatbot/files/flatbot.service +++ b/roles/flatbot/files/flatbot.service @@ -6,8 +6,7 @@ After=network.target Type=oneshot EnvironmentFile=/etc/flatbot/token EnvironmentFile=/etc/flatbot/config -EnvironmentFile=/etc/flatbot/urls -ExecStart=/usr/bin/flatbot -state ${FLATBOT_STATE} -once ${GREENWICH} ${CLERKENWELL} +ExecStart=/usr/local/bin/run-flatbot ${FLATBOT_STATE} ${FLATBOT_URLS} [Install] WantedBy=default.target diff --git a/roles/flatbot/files/run-flatbot b/roles/flatbot/files/run-flatbot new file mode 100755 index 0000000..1d8869d --- /dev/null +++ b/roles/flatbot/files/run-flatbot @@ -0,0 +1,27 @@ +#! /usr/bin/env bash + +# Simple wrapper script to read URLs from configuration file. + +if [ "$#" -ne 2 ]; then + echo "Illegal number of parameters" 1>&2 + exit 1 +fi + +state=$1 +urlsfile=$2 + +urls="" + +while IFS= read -r line; +do + case "$line" in + ""|\#*) + continue + ;; + *) + urls="${urls} ${line}" + ;; + esac +done < $urlsfile + +exec /usr/bin/flatbot -state $state -once ${urls} diff --git a/roles/flatbot/files/urls b/roles/flatbot/files/urls index 7b5c523..99005e7 100644 --- a/roles/flatbot/files/urls +++ b/roles/flatbot/files/urls @@ -1,2 +1,5 @@ -GREENWICH=https://www.rightmove.co.uk/property-for-sale/find.html?minBedrooms=2&propertyTypes=detached,semi-detached,terraced&sortType=2&areaSizeUnit=sqft&channel=BUY&index=0&tenureTypes=FREEHOLD,SHARE_OF_FREEHOLD&maxPrice=900000&radius=0.5&locationIdentifier=STATION^6122&maxDaysSinceAdded=7 -CLERKENWELL=https://www.rightmove.co.uk/property-for-sale/find.html?minBedrooms=2&sortType=2&areaSizeUnit=sqft&channel=BUY&index=0&maxPrice=900000&radius=0.5&locationIdentifier=STATION^3431&maxDaysSinceAdded=7 +# Greenwich +https://www.rightmove.co.uk/property-for-sale/find.html?minBedrooms=2&propertyTypes=detached,semi-detached,terraced&sortType=2&areaSizeUnit=sqft&channel=BUY&index=0&tenureTypes=FREEHOLD,SHARE_OF_FREEHOLD&maxPrice=900000&radius=0.5&locationIdentifier=STATION^6122&maxDaysSinceAdded=7 + +# Clerkenwell +https://www.rightmove.co.uk/property-for-sale/find.html?minBedrooms=2&sortType=2&areaSizeUnit=sqft&channel=BUY&index=0&maxPrice=900000&radius=0.5&locationIdentifier=STATION^3431&maxDaysSinceAdded=7 |