Compare commits
2 Commits
3de4ad2256
...
25009c0a16
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
25009c0a16 | ||
|
|
e58b75730a |
25
bin/executable_update-check.sh
Normal file
25
bin/executable_update-check.sh
Normal file
@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Checks for debian updates and informs a gotify server.
|
||||
#
|
||||
# MUST RUN AS ROOT (best in a cronjob)
|
||||
#
|
||||
|
||||
token="https://heavy.uber.space/gotify/message?token=Apw3EgT7BpQZ0rs"
|
||||
MYTEMPDIR="$(mktemp -d)"
|
||||
MYAPT="$MYTEMPDIR/apt-update.txt"
|
||||
trap 'rm -rf -- "$MYDIR"' EXIT
|
||||
|
||||
apt update > "$MYAPT" 2>&1
|
||||
MSG=$(tail -1 "$MYAPT")
|
||||
|
||||
if [[ $MSG =~ All.packages.are.up.to.date ]]; then
|
||||
echo $MSG
|
||||
else
|
||||
SUMMARY=$(echo "$MSG" | awk -F "." '{print $1}')
|
||||
LST="$(aptitude -F %p search '~U')"
|
||||
LST="$(echo $LST | tr '\n' ' ')"
|
||||
text="$SUMMARY ($(uname -n)):\n $LST"
|
||||
curl -H "Content-Type: application/json" -X POST $token -d "{\"title\":\"Debian Update Checker\",\"message\":\"$text\"}"
|
||||
fi
|
||||
|
||||
Loading…
Reference in New Issue
Block a user