Articles in this section

How to run Smart-Updates, Auto-Updates & Core Updates for one or all WordPress instances via CLI?

DoNotDelete:docref kb: how-to wordpress toolkit ext: wptk cli WordPress update

Question

How to run Smart-Updates, Auto-Updates & Core Updates for one or all WordPress instances via CLI?

Answer

# For Smart-Update

  1. Connect to a Plesk server via SSH

  2. List all Wordpress instances:

    # plesk ext wp-toolkit --list

  3. Check status of Smart-Updates for a specific instance:

    # plesk ext wp-toolkit --smart-update -instance-id 1 -operation status

  4. Turn on Smart-Updates for specific instance:

    # plesk ext wp-toolkit --smart-update -instance-id 1 -operation enable

# Auto-Updates for themes and plugins

  1. 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

  2. Enable auto-update for all themes for a specific instance:

    # plesk ext wp-toolkit --wp-cli -instance-id 1 -- theme auto-updates enable -all

  3. 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

  4. 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

  1. Check core version for a specific WordPress Instance:

    # plesk ext wp-toolkit --wp-cli -instance-id 1 -- core check-update

  2. 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

Additional Information

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.