You are not logged in.
Pages: 1
Hello,
i'm using Xubuntu 15.10. Is it possible to see a notification (notify-send) when
new updates available? I see only the task-icon in the windowlist.
Hope you have an idea!
Thanks a lot!
Offline
Hello and welcome.
I don't believe you can get the built-in update-notifier to send a notification bubble when updates are available.
Here is what I use instead:
1. Add the following command to the bottom of your ~/.bashrc file (this is required because I run the check in my cron and it needs access to these user session variables):
export | egrep "DBUS_SESSION_BUS_ADDRESS|DISPLAY" > ~/.xsession-export
2. Either log out and back in again or run that command manually to create the ~/.xsession-export file:
export | egrep "DBUS_SESSION_BUS_ADDRESS|DISPLAY" > ~/.xsession-export
3. Create the following script file:
#!/bin/bash
# get X session variables
# need to have: export | egrep "DBUS_SESSION_BUS_ADDRESS|DISPLAY" > ~/.xsession-export
# at the end of your ~/.bashrc file
. $HOME/.xsession-export
# The results
result1=`apt-get -s upgrade | grep "not upgraded" | cut -d" " -f1`
result2=`apt-get -s upgrade | grep "not upgraded" | cut -d" " -f3`
result3=`apt-get -s upgrade | grep "not upgraded" | cut -d" " -f6`
result4=`apt-get -s upgrade | grep "not upgraded" | cut -d" " -f10`
let result=$result1+$result2+$result3+$result4
if [ $result -gt 0 ]; then
notify-send -i dialog-information "Update Notification" "$result1 to be upgraded\n$result2 to be newly installed\n$result3 to be removed\n$result4 require dist-upgrade"
fi
exit 0
...and make it executable.
4. Create a cron entry to run this script (this cron entry runs every hour - change that to suit your needs):
0 * * * * /path/to/my/script
...and change "/path/to/my/script" to point to the script file you created.
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Hello ToZ.
Wow - that's more than i want! It looks fantastic - a notification with some details - great!
Thank you very much!
Offline
No worries. I added an if statement to the script so that the notification bubble only displays if there are updates available.
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Here is another version of the script file that uses the built-in update-notifier processes to check for updates. It executes a little faster and provides update information in a similar manner as the update-notifier:
#!/bin/bash
# get X session variables
# need to have: export | egrep "DBUS_SESSION_BUS_ADDRESS|DISPLAY" > ~/.xsession-export
# at the end of your ~/.bashrc file
. $HOME/.xsession-export
# get update-notifier available updates
/usr/lib/update-notifier/apt_check.py > /tmp/av 2>&1
result1=$(cat /tmp/av | awk 'BEGIN {FS = ";" } ; { print $1 }')
result2=$(cat /tmp/av | awk 'BEGIN {FS = ";" } ; { print $2 }')
let result=$result1+$result2
if [ $result -gt 0 ]; then
notify-send -i dialog-information "Updates Available" "$result1 packages can be updated\n$result2 updates are security updates"
fi
exit 0
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Hello ToZ.
Thank you for your answers! I'll try both versions and see wich one is the right for me.
Offline
Pages: 1
[ Generated in 0.009 seconds, 7 queries executed - Memory usage: 540.42 KiB (Peak: 541.7 KiB) ]