add timeout and error notice for is-installed check
This commit is contained in:
parent
8bf288e2c7
commit
e7962fdee0
|
@ -10,13 +10,13 @@ if [ "$USER" != "root" ]; then
|
||||||
exec sudo $0
|
exec sudo $0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# create empty virtualhostExclusionArray array (any domains added to this array will be skipped)
|
|
||||||
declare -a virtualhostExclusionArray
|
|
||||||
|
|
||||||
# create virtualhostArray listing all virtualhost on the server
|
# create virtualhostArray listing all virtualhost on the server
|
||||||
cd /srv/www
|
cd /srv/www
|
||||||
virtualhostArray=(`ls -1|grep -v ^html$`)
|
virtualhostArray=(`ls -1|grep -v ^html$`)
|
||||||
|
|
||||||
|
# create empty virtualhostExclusionArray array (any domains added to this array will be skipped)
|
||||||
|
declare -a virtualhostExclusionArray
|
||||||
|
|
||||||
# check for local config, which can be used to override either of the above arrays
|
# check for local config, which can be used to override either of the above arrays
|
||||||
if [[ -f /usr/local/etc/wp-cron.conf ]]; then
|
if [[ -f /usr/local/etc/wp-cron.conf ]]; then
|
||||||
source /usr/local/etc/wp-cron.conf
|
source /usr/local/etc/wp-cron.conf
|
||||||
|
@ -33,12 +33,13 @@ do
|
||||||
if [ -f /srv/www/$VHOST/html/wp-config.php ]; then
|
if [ -f /srv/www/$VHOST/html/wp-config.php ]; then
|
||||||
VHOST_USER=$(stat -c '%U' /srv/www/$VHOST)
|
VHOST_USER=$(stat -c '%U' /srv/www/$VHOST)
|
||||||
# confirm that WP really is installed
|
# confirm that WP really is installed
|
||||||
if $(su -c "wp core is-installed --path=/srv/www/$VHOST/html/" $VHOST_USER); then
|
if $(timeout 5 su -c "wp core is-installed --path=/srv/www/$VHOST/html/" $VHOST_USER); then
|
||||||
# run cron for VHOST as VHOST_USER
|
# run cron for VHOST as VHOST_USER
|
||||||
/usr/bin/logger --tag wp-cron "running wp-cli cron for $VHOST as $VHOST_USER"
|
/usr/bin/logger --tag wp-cron "running wp-cli cron for $VHOST as $VHOST_USER"
|
||||||
su -c "/usr/local/bin/wp cron event run --due-now --quiet --path=/srv/www/$VHOST/html/" $VHOST_USER
|
su -c "/usr/local/bin/wp cron event run --due-now --quiet --path=/srv/www/$VHOST/html/" $VHOST_USER
|
||||||
|
else
|
||||||
|
echo "NOTICE: 'wp core is-installed' failed for $VHOST (user $VHOST_USER)" | mail -s "wp-cron" webmaster -aFrom:webmaster
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user