From de84153bfc44612d5db2b68a5a1e788622845ff8 Mon Sep 17 00:00:00 2001 From: Ducky Date: Tue, 2 Apr 2024 02:36:24 +0100 Subject: [PATCH] various --- usr/local/bin/sh.zio.sys-daemon | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/usr/local/bin/sh.zio.sys-daemon b/usr/local/bin/sh.zio.sys-daemon index d77f1d2..d685883 100755 --- a/usr/local/bin/sh.zio.sys-daemon +++ b/usr/local/bin/sh.zio.sys-daemon @@ -30,6 +30,25 @@ function del_pidfile() { rm -f "$pidfile" } +function check_updates() { + function notify_update() { + prog="$1" + count="$2" + + /usr/local/bin/sh.zio.notify \ + --level "warning" \ + --message "**$(hostname -f)** completed startup at $(date "+%d-%b-%Y %H:%M:%S %Z")" \ + --title "Node online" + } + + if [[ -x "$(command -v dnf)" ]]; then + dnf_updates="$(dnf check-update -q|grep -c ^[a-z0-9])" + if [[ $dnf_updates > 0 ]]; then + notify_update "dnf" "$dnf_updates" + fi + if +} + function notify_startup() { /usr/local/bin/sh.zio.notify \ --level "info" \ @@ -41,6 +60,13 @@ function main() { check_pidfile notify_startup + + #while : + #do + # check_updates() + # sleep 3600 + #done + sleep infinity del_pidfile