wp-cli 安裝與使用

https://wp-cli.org/

curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
php wp-cli.phar – info
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp

使用

/usr/local/bin/wp – allow-root

範例

#!/bin/sh
# all web directories
target_path="/var/www/j7.lb168.tw"
## 安全緣故,改用 mysql_config_editor
#allow_root="--allow-root"

cron="cron event run – due-now"

# date format for backup file (dd-mm-yyyy)
date="$(date +"%Y.%m.%d-%H-%M")"

# mysql, mysqldump and some other bin's path
WP="/usr/local/bin/wp – allow-root"
CHOWN="$(which chown)"
OWNER="www-data"

cd $target_path
$WP $cron
$CHOWN -R $OWNER:$OWNER $target_path

exit 0;

發表迴響

回到頂端