Permalink
Browse files

Cleaned up code and added OS choice. Now can be used on OS X with the…

… help of Growl Notify.
  • Loading branch information...
1 parent 5423e3c commit 58782fdbf1686b8e2a721becda12b59d95cbc870 Shelby DeNike committed Jun 4, 2012
Showing with 14 additions and 25 deletions.
  1. +14 −25 ubuntu-notifyosd-script/wp-version-check.sh
@@ -3,7 +3,10 @@
# Change your WordPress URL here
# If your WordPress files reside in a sub-directory instead of domain root and you have your WP URL configured for the root, then you need to add the sub-directory too. Eg: http://blog.ashfame.com/wordpress
# Don't add a trailing slash at the end of the URL
-WPURL='http://blog.ashfame.com'
+WPURL='http://www.fauxzen.com'
+
+# OS Choice, UBUNTU, MAC
+OSTYPE='MAC'
WPVERSION="`wget -qO- $WPURL/wp-admin/admin-ajax.php?action=wp_version`"
@@ -18,31 +21,17 @@ RESULT="`wget -qO- $WPORG`"
declare -a z
z=($RESULT)
-if [ "${z[0]}" = 'upgrade' ]; then
+if [ "${z[0]}" = 'development' ]; then
@ashfame

ashfame Jul 14, 2012

Hey mate, why did you change this to development?

@ashfame

ashfame Jul 14, 2012

I understand that when any version above the latest one is passed to the API, then it returns "development", but doesn't that mean, it will trigger the notification every single time?

@sdenike

sdenike Jul 14, 2012

Owner

Whoops that shouldn't be there. If I recall when I was testing I was doing so on my install that was running a nightly build.

@ashfame

ashfame Jul 14, 2012

Got ya! BTW I have committed your changes in my repo. Thanks mate!

@sdenike

sdenike Jul 14, 2012

Owner

Awesome! Hope that I have some freetime soon to add some more to it as well

NEWVER=${z[3]}
- notify-send -t 2000 -i $DIR/wp.png "WordPress $NEWVER released" "Update your installs now"
-fi
-
-exit
+
+ if [[ $OSTYPE =~ MAC ]]; then
+ growlnotify --image wp.png WordPress Notifyer -m "WordPress $NEWVER released" "Update your installs now"
+ fi
-#
-# Following code is only kept for reference (I am not a shell scripting nerd!)
-#
+ if [[ $OSTYPE =~ UBUNTU ]]; then
+ notify-send -t 2000 -i $DIR/wp.png "WordPress $NEWVER released" "Update your installs now"
+ fi
-# Working code (without version number) using a tmp file in user folder
-<<COMMENT
-wget -q -O /home/ashfame/wp-version-check.txt $URL
-grep -i "upgrade" /home/ashfame/wp-version-check.txt
-if [ $? -eq 0 ] ; then
-DISPLAY=:0 notify-send -t 2000 -i /home/ashfame/Dropbox/Ubuntu/icons/wp.png "WordPress Version outdated!" "Please update!"
fi
-rm /home/ashfame/wp-version-check.txt
-COMMENT
-
-# Working code using pipeline (but not sufficient to extract the version number from wget)
-<<COMMENT1
-wget -qO- $URL | grep "upgrade"
-if [ $? -eq 0 ] ; then
-DISPLAY=:0 notify-send -t 2000 -i /home/ashfame/Dropbox/Ubuntu/icons/wp.png "WordPress Version outdated!" "Please update!"
-fi
-COMMENT1
+
+exit

0 comments on commit 58782fd

Please sign in to comment.