scripts/wordpress_cron

34 lines
836 B
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/sh
# This script do the following:
# Use wp-cli (https://make.wordpress.org/cli/handbook/installing/)
# Verify if an update is available for WordPress plugins.
# Create a file you need to monitore.
WP_ROOT="/var/www/wordpress"
WP_CLI_PATH="/usr/local/bin/wp"
WP_UPDATE_LOG="${WP_ROOT}/.update"
if [ ! -d "${WP_ROOT}" ]; then
printf '%b' "${WP_ROOT} does not seem to be a WordPress install.\n"
exit 1
fi
if [ ! -d "${WP_CLI_PATH}" ]; then
printf '%b' "${WP_CLI_PATH} does not seem to be available.\n"
exit 1
fi
WP_UPDATE=$(sudo -u www-data -- "${WP_CLI_PATH}" --path="${WP_ROOT}" plugin list|grep available)
# Verify if the variable contains something
if [ -z "${WP_UPDATE}" ]; then
#rm -f "${WP_UPDATE_LOG}"
printf '%b' "Nothing to do\n"
else
#touch "${WP_UPDATE_LOG}"
printf '%b' "Please upgrade\n"
fi
exit 0