Fedora/Yum update notification in OpenBox
OpenBox is a minimalist windows manager for Linux, it’s also my manager of choice. Due to its minimal memory footprint its faster than Gnome or KDE, but because its minimal a lot of what you may have come to know and move is no enabled by default.
I will cover more about OpenBox and its configuration in future posts, but this evening I decided to check for any updates to Fedora 21 and to my surprise I found over 200 updates waiting on me. I know, I am really bad at checking for updates but so are you so don’t judge!
When you log into KDE or Gnome many other services and background programs are run, one of which checks for system updates and alerts you. There is no such thing running by default when your first run OpenBox so I created a Bash script that runs in cron. It uses the
notify-send command to pop-up alerts when updates are available.
Create a new file in
/usr/local/bin/yum-watch and copy in:
#!/bin/sh if [ -f /tmp/yum_watch.lock ]; then echo "The process is already launched, please wait..." exit 1; fi touch /tmp/yum_watch.lock UPDATES_COUNT=$(yum check-update --quiet | grep -v "^$" | wc -l) if [[ $UPDATES_COUNT -gt 0 ]]; then notify-send -u critical "$UPDATES_COUNT system updates available" fi rm /tmp/yum_watch.lock
Now make sure the file is executable with
sudo chmod 700 /usr/local/bin/yum-watch. Now just add your new command to cron or run it at startup and you’ll start getting notifications if and when new updates are available.