Compare commits
No commits in common. "25009c0a16888695d39926f89bf238798cc52a71" and "3de4ad22562307ec42f073837ef5f2ba268c92cb" have entirely different histories.
25009c0a16
...
3de4ad2256
@ -1,25 +0,0 @@
|
|||||||
#!/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