From 55e256ad5978e65a1a18b678160a282d2d45bac7 Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Sat, 13 Feb 2021 20:04:54 +0000 Subject: [PATCH] Adds a timer that checks for restock of pinecil --- systemd/.config/systemd/user/checkStock | 9 +++++++++ systemd/.config/systemd/user/stock.service | 8 ++++++++ systemd/.config/systemd/user/stock.timer | 9 +++++++++ 3 files changed, 26 insertions(+) create mode 100755 systemd/.config/systemd/user/checkStock create mode 100644 systemd/.config/systemd/user/stock.service create mode 100644 systemd/.config/systemd/user/stock.timer diff --git a/systemd/.config/systemd/user/checkStock b/systemd/.config/systemd/user/checkStock new file mode 100755 index 00000000..43388d43 --- /dev/null +++ b/systemd/.config/systemd/user/checkStock @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +url="https://pine64.com/product/pinecil-smart-mini-portable-soldering-iron/" +string="out of stock" + +curl -sL "$url" | hq h1 text | grep -vqi "$string" +if [ "$?" -eq 0 ]; then + notify-send "Pinecil back in stock" +fi diff --git a/systemd/.config/systemd/user/stock.service b/systemd/.config/systemd/user/stock.service new file mode 100644 index 00000000..7135f867 --- /dev/null +++ b/systemd/.config/systemd/user/stock.service @@ -0,0 +1,8 @@ +[Unit] +Description=Check stock + +[Service] +ExecStart=/home/jonathan/.config/systemd/user/checkStock + +[Install] +WantedBy=default.target diff --git a/systemd/.config/systemd/user/stock.timer b/systemd/.config/systemd/user/stock.timer new file mode 100644 index 00000000..19a97cc4 --- /dev/null +++ b/systemd/.config/systemd/user/stock.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Check stock every hour + +[Timer] +OnBootSec=1h +OnUnitActiveSec=1h + +[Install] +WantedBy=timers.target