Skip to content

Instantly share code, notes, and snippets.

@chales
Last active December 20, 2015 17:19
Show Gist options
  • Save chales/6168048 to your computer and use it in GitHub Desktop.
Save chales/6168048 to your computer and use it in GitHub Desktop.
Drupal multi-site cron with basic auth option. Targets a sites directory to get a list of available sites to process. Add sites to exclude to the egrep list.
#!/bin/bash
# This script will iterate through the sites directory of a multi-site install
# and run the cron.php for each named site in the directory.
# NOTE: the domain defined in 'sites/default' must be run separately or via a symlink.
DEFAULTDOMAIN=www.example.com
# Set the system path for the multi-site "sites" directory
SITESROOT=/path/to/drupal/sites
# Handle the default site
wget -O - -q http://$DEFAULTDOMAIN/cron.php
# Switch to your sites directory
cd $SITESROOT
# Exclude options her such as dev sites.
for site in $(ls |egrep -v "all|default|.svn|example.dev")
do
# Basic cron
wget -O - -q http://$site/cron.php
# With basic auth options
#wget --user={username} --password={my password} -O - -q http://$site/cron.php
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment