Skip to content

Commit fe3d285

Browse files
authored
fix proper cron
use `wp cli`
1 parent 59f5f7f commit fe3d285

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

wordpress_install.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,9 @@ install_if_not apt-transport-https
158158
# Install build-essentials to get make
159159
install_if_not build-essential
160160

161+
# Needed for cron(tab)
162+
install_if_not cron
163+
161164
# Set DNS resolver
162165
# https://unix.stackexchange.com/questions/442598/how-to-configure-systemd-resolved-and-systemd-networkd-to-use-local-dns-server-f
163166
while :
@@ -522,10 +525,10 @@ mv "$PHP_POOL_DIR"/www.conf "$PHP_POOL_DIR"/www.conf.backup
522525
restart_webserver
523526

524527
# Force wp-cron.php (updates WooCommerce Services and run Scheluded Tasks)
525-
if [ -f "$WPATH/wp-cron.php" ]
528+
if [ -f "$WPATH/wp-cron.php" ] && [ -f $WPATH/wp-cli.yml ]
526529
then
527530
chmod +x "$WPATH/wp-cron.php"
528-
crontab -u www-data -l | { cat; echo "14 */1 * * * php -f $WPATH/wp-cron.php > /dev/null 2>&1"; } | crontab -u www-data -
531+
crontab -u www-data -l | { cat; echo "14 */1 * * * wp cron event run --due-now --path='/var/www/html/wordpress' > 2>&1"; } | crontab -u www-data -
529532
fi
530533

531534
# Install Figlet

0 commit comments

Comments
 (0)