diff --git a/roles/mirrormanager/crawler/files/run_crawler.sh b/roles/mirrormanager/crawler/files/run_crawler.sh index 3269dea96e..251d90cb05 100644 --- a/roles/mirrormanager/crawler/files/run_crawler.sh +++ b/roles/mirrormanager/crawler/files/run_crawler.sh @@ -6,27 +6,11 @@ fi NUMBER_OF_CRAWLERS=$1 HOST=`hostname -s` -MAX_HOST=`/usr/local/bin/mm2_get-highest-active-host-id` +START_STOP="/usr/local/bin/mm2_get-mirrors-to-crawl" -# make MAX_HOST a multiple of NUMBER_OF_CRAWLERS -let FIX=${MAX_HOST}%${NUMBER_OF_CRAWLERS} - -if [ "${FIX}" -ne "0" ]; then - let MAX_HOST=${MAX_HOST}+${NUMBER_OF_CRAWLERS}-${FIX} -fi - -let PART=${MAX_HOST}/${NUMBER_OF_CRAWLERS} - -STARTID=0 -STOPID=${PART} for i in `seq 1 ${NUMBER_OF_CRAWLERS}`; do if [ "${HOST}" == "mm-crawler0${i}" ]; then - echo "--startid=${STARTID} --stopid=${STOPID}" + ${START_STOP} -f ${i}:${NUMBER_OF_CRAWLERS} fi - let STARTID=${STARTID}+${PART} - let STOPID=${STOPID}+${PART} - if [ "${STOPID}" -eq "${MAX_HOST}" ]; then - let STOPID=${STOPID}+1 - fi done diff --git a/roles/mirrormanager/crawler/tasks/main.yml b/roles/mirrormanager/crawler/tasks/main.yml index 4642393c20..f3ac6922ff 100644 --- a/roles/mirrormanager/crawler/tasks/main.yml +++ b/roles/mirrormanager/crawler/tasks/main.yml @@ -35,8 +35,8 @@ - config when: env != 'staging' -- name: install the script to get the highest mirror id - copy: src=mm2_get-highest-active-host-id dest=/usr/local/bin/mm2_get-highest-active-host-id mode=0755 +- name: install the script to distribute the mirrors to crawl + copy: src=mm2_get-mirrors-to-crawl dest=/usr/local/bin/mm2_get-mirrors-to-crawl mode=0755 - name: install the crawler distribute script copy: src=run_crawler.sh dest=/usr/local/bin/run_crawler.sh mode=0755