Linux Lite 8.0 RC1 has been released - Click here


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Desktop notification for Install Updates
#1

[Image: vXW9ygl.png]

Implementation:

Create the update notification script:

Code:
sudo touch /usr/local/sbin/updatenotify

Code:
sudo leafpad /usr/local/sbin/updatenotify

insert:

Code:
#!/bin/bash

xhost local:$USER > /dev/null 2>&1
export DISPLAY=:0
apt-get update > /dev/null 2>&1
UPD=$(/usr/lib/update-notifier/apt-check --human-readable && echo && echo Click here to remove this message)
notify-send -i /usr/share/icons/Faenza/apps/48/system-software-installer.png -t 10 -u critical 'Install Updates' "$UPD"
exit

for message that must be clicked on to disappear.

Alternatively:

Code:
#!/bin/bash

xhost local:$USER > /dev/null 2>&1
export DISPLAY=:0
apt-get update > /dev/null 2>&1
UPD=$(/usr/lib/update-notifier/apt-check --human-readable && echo && echo Click here to remove this message)
notify-send -i /usr/share/icons/Faenza/apps/48/system-software-installer.png 'Install Updates' "$UPD"
exit

for default 5 second notification.

Code:
#!/bin/bash

xhost local:$USER > /dev/null 2>&1
export DISPLAY=:0
apt-get update > /dev/null 2>&1
UPD=$(/usr/lib/update-notifier/apt-check --human-readable && echo && echo Click here to remove this message)
notify-send -i /usr/share/icons/Faenza/apps/48/system-software-installer.png --expire-time=10000 'Install Updates' "$UPD"
exit

for 10 second notification (preferred).

Make the file executable:

Code:
sudo chmod +x /usr/local/sbin/updatenotify

save and close.

Add all users that have sudo access to /usr/local/sbin/updatenotify only.

Code:
sudo visudo

add:

Code:
$USER ALL=NOPASSWD: /usr/local/sbin/updatenotify

to the bottom of the file.

Create a cronjob as the user (to run hourly):

Code:
crontab -e

Code:
0 * * * * /usr/local/sbin/updatenotify >/dev/null 2>&1

Download your free copy of Linux Lite today.

Jerry Bezencon
Linux Lite Creator

"Do not correct a fool, or he will hate you; correct a wise man and he will appreciate you."

[Image: X5qGkCg.png]

[Image: 0op1GNe.png] [Image: LgJ2mtP.png] [Image: vLZcFUE.png] [Image: lrUHro3.jpg]
Reply
#2

Would like a similar notification to inform users that they can upgrade to next LL in Series.

The end product would utilize the various cron directories in /etc. hourly, daily, monthly.
It would also be accompanied by a basic config tool to choose how often you want the checks to be made.

Download your free copy of Linux Lite today.

Jerry Bezencon
Linux Lite Creator

"Do not correct a fool, or he will hate you; correct a wise man and he will appreciate you."

[Image: X5qGkCg.png]

[Image: 0op1GNe.png] [Image: LgJ2mtP.png] [Image: vLZcFUE.png] [Image: lrUHro3.jpg]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)