- Install the admin_notifications app
- Create
system-notifications.shwith the content from below on your system - Add the script to the cronjob
crontab -u www-data -e:
0 10 * * * /path/to/file/system-notifications.sh
system-notifications.sh with the content from below on your systemcrontab -u www-data -e:0 10 * * * /path/to/file/system-notifications.sh
| #!/usr/bin/env bash | |
| # | |
| # @license MIT | |
| # @copyright 2017 Joas Schilling [email protected] | |
| ADMIN="admin" | |
| OCC_PATH="/var/www/nextcloud/occ" | |
| PACKAGES=$(/usr/lib/update-notifier/apt-check -p 2>&1) | |
| NUM_PACKAGES=$(echo "$PACKAGES" | wc -l) | |
| if [ "$PACKAGES" != "" ]; then | |
| UPDATE_MESSAGE=$(echo "Packages to update: $PACKAGES" | sed -r ':a;N;$!ba;s/\n/, /g') | |
| $OCC_PATH notification:generate $ADMIN "$NUM_PACKAGES packages require to be updated" -l "$UPDATE_MESSAGE" | |
| elif [ -f /var/run/reboot-required ]; then | |
| $OCC_PATH notification:generate $ADMIN "System requires a reboot" | |
| fi |
Discuss on https://help.nextcloud.com/t/howto-get-notifications-for-system-updates/10299