diff --git a/src/roles/mediawiki/tasks/main.yml b/src/roles/mediawiki/tasks/main.yml index a7fadb0e..cb202dfb 100644 --- a/src/roles/mediawiki/tasks/main.yml +++ b/src/roles/mediawiki/tasks/main.yml @@ -476,6 +476,7 @@ with_items: - elastic-rebuild-all.sh - smw-rebuild-all.sh + - run-all-jobs-now.sh - refresh-links.sh - name: Ensure data rebuilding logs directories exist diff --git a/src/roles/mediawiki/templates/elastic-rebuild-all.sh.j2 b/src/roles/mediawiki/templates/elastic-rebuild-all.sh.j2 index e773d3a2..c2da4efe 100644 --- a/src/roles/mediawiki/templates/elastic-rebuild-all.sh.j2 +++ b/src/roles/mediawiki/templates/elastic-rebuild-all.sh.j2 @@ -137,32 +137,3 @@ for d in $do_wikis; do # Do ^ for each wiki, since the indexing will take a while done - -# -# FOURTH wiki loop: run all jobs for all wikis -# -for d in $do_wikis; do - - if [ -z "$1" ]; then - wiki_id=${d%/} - else - wiki_id="$d" - fi - - if [ ! -d "$wiki_dir/$wiki_id" ]; then - echo "\"$wiki_id\" not a valid wiki ID" - continue - fi - - # Run all the jobs for this wiki - maxjobs=1000 - while [ $(WIKI="$wiki_id" php /opt/htdocs/mediawiki/maintenance/showJobs.php) -gt 0 ]; do - WIKI="$wiki_id" php /opt/htdocs/mediawiki/maintenance/runJobs.php --maxjobs="$maxjobs" - echo - echo "Up to 1000 jobs complete. Pausing for 5 seconds." - echo - sleep 5 - done; - -done - diff --git a/src/roles/mediawiki/templates/run-all-jobs-now.sh.j2 b/src/roles/mediawiki/templates/run-all-jobs-now.sh.j2 new file mode 100644 index 00000000..c30cf4f9 --- /dev/null +++ b/src/roles/mediawiki/templates/run-all-jobs-now.sh.j2 @@ -0,0 +1,46 @@ +#!/bin/sh + +echo "Starting rebuilding search indexes as $(whoami)" + +if [ -z "$1" ]; then + do_wikis="*/" +else + do_wikis="$1" +fi + +wiki_dir="/opt/htdocs/wikis" + +cd "$wiki_dir" + +# +# FOURTH wiki loop: run all jobs for all wikis +# +for d in $do_wikis; do + + if [ -z "$1" ]; then + wiki_id=${d%/} + else + wiki_id="$d" + fi + + if [ ! -d "$wiki_dir/$wiki_id" ]; then + echo "\"$wiki_id\" not a valid wiki ID" + continue + fi + + echo + echo "Running all jobs for ${wiki_id}" + echo + + + # Run all the jobs for this wiki + maxjobs=1000 + while [ $(WIKI="$wiki_id" php /opt/htdocs/mediawiki/maintenance/showJobs.php) -gt 0 ]; do + WIKI="$wiki_id" php /opt/htdocs/mediawiki/maintenance/runJobs.php --maxjobs="$maxjobs" + echo + echo "Up to 1000 jobs complete. Pausing for 5 seconds." + echo + sleep 5 + done; + +done