Created
January 3, 2014 06:03
-
-
Save mattrude/8233586 to your computer and use it in GitHub Desktop.
A bash script to continuously run the runJobs.php script in small batches to allow a slow server to keep up and still allow public traffic on the site. This script should be placed in the mediawiki maintenance directory.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run meny MediaWiki Jobs | |
while [ `php showJobs.php` != 0 ]; | |
do | |
echo -n "Starting over; `php showJobs.php` jobs left to run; running 10 jobs in 2 cycles." | |
php runJobs.php --maxjobs 10 --procs 5 --quiet | |
LOAD="`uptime |awk '{ print $10 }' |sed 's/,//g'`" | |
if [ $LOAD > 1.9 ]; then | |
WAIT=`echo "sqrt(2 * $LOAD * 50)" |bc` | |
echo " - Sleeping for $WAIT secs" | |
sleep $WAIT | |
else | |
echo " - Not sleeping" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment