added update-notify.sh

added node_dir_size_exporter.sh
This commit is contained in:
Samuel Philipp 2020-12-30 01:58:16 +01:00
parent 8e1af22017
commit f20f1349c5
2 changed files with 29 additions and 0 deletions

View file

@ -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"

21
update-notify.sh Normal file
View file

@ -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