Skip to content

Instantly share code, notes, and snippets.

@Cobesz
Last active February 28, 2023 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Cobesz/d317f34ee451b6d956118d32a07a12f5 to your computer and use it in GitHub Desktop.
Save Cobesz/d317f34ee451b6d956118d32a07a12f5 to your computer and use it in GitHub Desktop.
Small bash script to update all wordpress webapplications - only minor updates
#!/bin/bash
array=($(ls /home/))
for i in "${array[@]}"; do #loop through all users in home folder
if [ $i = user_1 ] || [ $i = user_2 ]; then #exclude certain users
echo "Skipped $1"
else
echo $i
cd /home/$i/<path>/<to>/<wordpress>/<dir>/*
echo "Starting updating of $i in the following path: $(pwd)"
sudo su -c "wp core update --minor && wp theme update --all && wp plugin update --minor --all --exclude=<pluginname_to_exclude>" $i
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment