Question
How to run Smart-Updates, Auto-Updates & Core Updates for one or all WordPress instances via CLI?
Answer
# For Smart-Update
-
Connect to a Plesk server via SSH
-
List all Wordpress instances:
# plesk ext wp-toolkit --list
-
Check status of Smart-Updates for a specific instance:
# plesk ext wp-toolkit --smart-update -instance-id 1 -operation status
-
Turn on Smart-Updates for specific instance:
# plesk ext wp-toolkit --smart-update -instance-id 1 -operation enable
# Auto-Updates for themes and plugins
-
Check status of auto-update for all themes for a specific instance:
# plesk ext wp-toolkit --wp-cli -instance-id 1 -- theme auto-updates status -all
-
Enable auto-update for all themes for a specific instance:
# plesk ext wp-toolkit --wp-cli -instance-id 1 -- theme auto-updates enable -all
-
Check status of auto-update for all plugins for a specific instance:
# plesk ext wp-toolkit --wp-cli -instance-id 1 -- plugin auto-updates status -all
-
Enable auto-update for all plugins specific for a instance:
# plesk ext wp-toolkit --wp-cli -instance-id 1 -- plugin auto-updates enable -all
# WordPress Core Update
-
Check core version for a specific WordPress Instance:
# plesk ext wp-toolkit --wp-cli -instance-id 1 -- core check-update
-
Update core for a specific WordPress Instance:
# plesk ext wp-toolkit --wp-cli -instance-id 1 -- core update
# WordPress Core Auto-Update
The only way to do this currently is by editing the wp-config.php file and adding the following line:
define( 'WP_AUTO_UPDATE_CORE' , true );
# Check Smart Update status for all instances
Note: Running such a command/script can be dangerous as it will affect all WordPress instances. A snapshot or backup should be created prior to running this. Run the command against a single instance first to make sure the syntax and command is correct before running the script against all instances.
# plesk ext wp-toolkit --list | awk NF | awk '{print $1}' | awk '(NR>1)' | while read i; do plesk ext wp-toolkit --smart-update -instance-id $i -operation status; done
This command will check operation status for --smart-update on all instances.
This command can be edited to enable all instances by changing -operation status to -operation enable
Comments
0 comments
Please sign in to leave a comment.