Automate Drupal Update with Drush via Shell Script

date

cd $HOME/bin

. config.sh

cd $DRUPALHOME

 # turn on maintenance mode
drush variable-set --exact maintenance_mode 1

drush en -y update

 # update to the latest version of modules
drush up -y

drush dis -y update

drush pm-uninstall -y update

 # Remove install.php to reduce hacking chances.
rm install.php

 # Turn off maintenance mode
drush variable-set --exact maintenance_mode 0

 # Clear all caches
drush cc all

 # Run cron
drush cron

date
Updated: 2020-07-15 | Posted: 2016-02-04