Answer the question
In order to leave comments, you need to log in
Why doesn't bash show a variable inside echo when run from Cron?
There is a script
#!/bin/bash
RESULT=$(/usr/local/bin/wp core verify-checksums --allow-root --path=/var/www/web/)
IS_OK=${RESULT:0:7}
if [ "$IS_OK" == "Success" ]; then
echo "No problem found. Have a nice day!"
else
echo "Problem is: >>> $RESULT <<<"
fi
/usr/local/bin/wp core verify-checksums --allow-root --path=/var/www/web/
Answer the question
In order to leave comments, you need to log in
When run via Cron, $RESULT is always empty.
Why?
RESULT=$(/usr/local/bin/wp core verify-checksums --allow-root --path=/var/www/web/ 2>&1 )
IS_OK=$?
if [ $IS_OK == 0 ]; then
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question