-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move job running out of elastic-rebuild-all
- Loading branch information
1 parent
76052b2
commit ec0e9fc
Showing
3 changed files
with
47 additions
and
29 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |