diff --git a/node_dir_size_exporter.sh b/node_dir_size_exporter.sh new file mode 100644 index 0000000..7ee98e5 --- /dev/null +++ b/node_dir_size_exporter.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +DIR=$1 +KEY=$2 +FILE=$3 + +du -bsx $DIR | sed "s/\([0-9]*\).*\/\(.*\)/node_dir_size{name=\"\2\",key=\"$KEY\"} \1/" > "$FILE$$" +mv "$FILE$$" "$FILE" diff --git a/update-notify.sh b/update-notify.sh new file mode 100644 index 0000000..d31f4eb --- /dev/null +++ b/update-notify.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +GOTIFY_FILE=$(<~/.gotify) +GOTIFY_TOKEN=${GOTIFY_FILE##*( )} +HOST="$(hostname)" +TITLE="Updates available on $HOST" + +if [ "$EUID" -ne 0 ]; then + echo "Please run as root" + exit +fi + +apt update + +UPDATE=$(apt list --upgradable) + +echo "$UPDATE" + +if [[ $UPDATE == *$'\n'* ]]; then + curl -F "title=$TITLE" -F "message=$UPDATE" -F "priority=5" "https://push.sp-codes.de/message?token=$GOTIFY_TOKEN" +fi