switch default to quiet mode, with verbose as an option. and format Failure as red-bold
This commit is contained in:
parent
7a45632e0b
commit
faf2012f7a
|
@ -6,12 +6,12 @@
|
||||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
|
|
||||||
# must be root, will su to vhost users for wp cron runs
|
# must be root, will su to vhost users for wp cron runs
|
||||||
if [ "$USER" != "root" ]; then
|
if [[ "$USER" != "root" ]]; then
|
||||||
exec sudo $0
|
exec sudo $0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# add -q command line option for quiet mode, which only outputs hard failures
|
# add -v command line option for verbose mode, which can show many non-error warnings
|
||||||
# otherwise this script runs in verbose mode which shows more info, including 'File should not exist' warnings
|
# otherwise script runs in quiet mode which only outputs hard failures
|
||||||
|
|
||||||
# create virtualhostArray listing all virtualhost on the server
|
# create virtualhostArray listing all virtualhost on the server
|
||||||
cd /srv/www
|
cd /srv/www
|
||||||
|
@ -20,17 +20,17 @@ virtualhostArray=(`ls -1|grep -v ^html$`)
|
||||||
for VHOST in "${virtualhostArray[@]}"
|
for VHOST in "${virtualhostArray[@]}"
|
||||||
do
|
do
|
||||||
# basic check for WP install
|
# basic check for WP install
|
||||||
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 $(timeout 5 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 verify-checksums for VHOST as VHOST_USER
|
# run verify-checksums for VHOST as VHOST_USER
|
||||||
if [[ $1 = '-q' ]]; then
|
if [[ $1 = '-v' ]]; then
|
||||||
timeout 10 su -c "/usr/local/bin/wp core verify-checksums --include-root --path=/srv/www/$VHOST/html/ --quiet" $VHOST_USER
|
|
||||||
else
|
|
||||||
echo
|
echo
|
||||||
echo "running verify-checksums on $VHOST"
|
echo "running verify-checksums on $VHOST"
|
||||||
timeout 10 su -c "/usr/local/bin/wp core verify-checksums --include-root --path=/srv/www/$VHOST/html/" $VHOST_USER
|
timeout 10 su -c "/usr/local/bin/wp core verify-checksums --include-root --path=/srv/www/$VHOST/html/" $VHOST_USER || echo -e "\e\033[01;31mFailure:\e\033[m $VHOST failed verification"
|
||||||
|
else
|
||||||
|
timeout 10 su -c "/usr/local/bin/wp core verify-checksums --include-root --path=/srv/www/$VHOST/html/ --quiet" $VHOST_USER || echo -e "\e\033[01;31mFailure:\e\033[m $VHOST failed verification"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "NOTICE: wp core is-installed failed for $VHOST (user $VHOST_USER)"
|
echo "NOTICE: wp core is-installed failed for $VHOST (user $VHOST_USER)"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user