Multi-site Cron Bash Script
Site administrators · Drupal 4.6.x · Drupal 4.7.x · Drupal 5.x · Drupal 6.x · Drupal 7.x · No known problems
Last modified: May 8, 2009 - 15:34
A quick bash script to run cron for multiple sites:
#!/bin/bash
## Define your websites in an array
sites=(example.com example2.com example3.com)
len=${#sites[*]}
for((i=0; i<$len; i++)); do
wget -q http://${sites[${i}]}/cron.php
# You may remove (or comment) the following line if you
# wish to retain the downloaded file.
rm cron.php
done
minor glitch in here
len=${#sites}only returns the length of the first element of the array.Change it to
len=${#sites[*]}to return the total number of elements in the array.Jan
PS: The array can also contain slashes, in case your drupal installation is not in the server root.
PPS: (edit) if you change your wget command to include -O - (that is no zero, it's an O) you have no files to delete:
wget -O - -q -t 1 http://...THX for correcting
THX for correcting