LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   update notifier for xfce - desktop independent (http://www.linuxquestions.org/questions/programming-9/update-notifier-for-xfce-desktop-independent-4175460142/)

Andy Alkaline 04-30-2013 09:25 AM

update notifier for xfce - desktop independent
 
I've made two bash scripts, one to check and one to notify. They work, but any improvement suggestions are welcome. I'm also posting them here for people who have something like this on their wish list. I think the biggest problem is that I don't know how to determine a dynamic display number, so 0.0 is always used, but I think for the average user that shouldn't be a problem.

Code:

#!/bin/bash
# anyDE-update-check.sh 0.5.1
# April 30, 2013
#
# run as root from a cron job
# ex: 0 */6 * * * /usr/bin/anyDE-update-check.sh
USER=andy
SCRIPTPATH=/home/$USER/bin

pgrep anyDE-update-no > /dev/null

if [ $? -eq 0 ]; then
        exit 0
fi

apt-get dist-upgrade --assume-no > /dev/null

if [ $? -eq 1 ]; then
        DISPLAY=:0.0 su $USER -c $SCRIPTPATH/anyDE-update-notifier.sh &
fi

exit $?

Code:

#!/bin/bash
# anyDE-update-notifier.sh 0.1.0
# April 30, 2013
#
# Use with anyDE-update-check.sh
#
# see man xterm for options, to be used with anyDE-update-check.sh

OPTIONS="-iconic -hold -geometry 50x5"

xterm $OPTIONS -T "Updates Available"  -e 'echo Updates are available'


Andy Alkaline 04-30-2013 12:51 PM

For those preferring an alternate implementation, someone suggested the update-notifier package to me in the Debian forum:

http://www.linuxquestions.org/questi...ce-4175460151/


All times are GMT -5. The time now is 08:31 PM.