From 8bf288e2c7909b69172c0548cfef47c6dba15b8a Mon Sep 17 00:00:00 2001 From: Matthew Saunders Brown Date: Mon, 11 Sep 2023 15:38:41 -0700 Subject: [PATCH] add local config option --- sbin/wp-cron.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sbin/wp-cron.sh b/sbin/wp-cron.sh index 88fd174..202ae27 100755 --- a/sbin/wp-cron.sh +++ b/sbin/wp-cron.sh @@ -10,13 +10,21 @@ if [ "$USER" != "root" ]; then exec sudo $0 fi +# create empty virtualhostExclusionArray array (any domains added to this array will be skipped) declare -a virtualhostExclusionArray -# optionally add virtualhosts to virtualhostExclusionArray to have them skipped -# create virtualhostArray +# create virtualhostArray listing all virtualhost on the server cd /srv/www virtualhostArray=(`ls -1|grep -v ^html$`) +# check for local config, which can be used to override either of the above arrays +if [[ -f /usr/local/etc/wp-cron.conf ]]; then + source /usr/local/etc/wp-cron.conf + # conf file could contain either one or both arrays, configured like this: + #virtualhostArray=("example.com" "example.net") + #virtualhostExclusionArray=("example.org") +fi + for VHOST in "${virtualhostArray[@]}" do # check if VHOST has been added to exclustion array