以下是我开始每日更新WordPress的方式:
cat <<-"CRON_DAILY" > /etc/cron.daily/nses_cron_daily
for dir in /var/www/html/*/; do cd "$dir" && /usr/local/bin/wp plugin update --all --allow-root; done
for dir in /var/www/html/*/; do cd "$dir" && /usr/local/bin/wp core update --allow-root; done
for dir in /var/www/html/*/; do cd "$dir" && /usr/local/bin/wp theme update --all --allow-root; done
chown www-data:www-data /var/www/html/* -R
find /var/www/html/* -type d -exec chmod 755 {} \\;
find /var/www/html/* -type f -exec chmod 644 {} \\;
CRON_DAILY
chmod +x /etc/cron.daily/nses_cron_daily
我使用heredocument创建文件,更改权限,并每天运行。有没有一种更短、无插件的更新方式(行更少,哈哈哈)?