Skip to content

Instantly share code, notes, and snippets.

@homu9
Created April 13, 2022 19:54
Show Gist options
  • Save homu9/7d68b59aeb24c6f02455b776263041a2 to your computer and use it in GitHub Desktop.
Save homu9/7d68b59aeb24c6f02455b776263041a2 to your computer and use it in GitHub Desktop.
Bulk update plugins for runcloud
#!/bin/bash
# Change directory to /home
cd /home
# Iterate through all users directories
for user in * ; do
# For every webapp under the user directory
# Count wp-config files to make sure its Wordpess
# If its Wordpress, then run the WP CLI Script, which calls wp-cron.php
cd /home/$user/webapps
for d in * ; do
count_file=`ls -1 /home/$user/webapps/$d/wp-config.php 2>/dev/null | wc -l`
if [ "$count_file" != "0" ]
then
echo $d 'is WordPress'
cd /home/$user/webapps/$d
sudo -u $user wp plugin update --all --quiet
sudo -u $user wp wc update
sudo -u $user wp cache flush
sudo -u $user wp plugin update --all --quiet
fi
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment