#!/bin/bash # check WP Version wp_new=`curl -s -Lk https://wordpress.org/download/ 2>/dev/null | grep -o -P '(?<=Download WordPress ).*(?=)'` wp_local=`curl -s -Lk $1 2>/dev/null | grep -o -P '(?<="WordPress ).*(?=" />)'` # Nagios exit code ST_OK=0 ST_WR=1 ST_CR=2 ST_UK=3 if [ "$wp_new" == "" ] || [ "$wp_local" == "" ] ; then echo "UNKNOW - curl command failed or $1 not available" exit $ST_UK fi if [ "$wp_new" == "$wp_local" ]; then echo "OK - Wordpress is updated ($wp_local)." exit $ST_OK fi if [ "$wp_new" != "$wp_local" ]; then echo "WARNING - WordPress (Version $wp_new) is available. Current Version $wp_local" exit $ST_WR fi