Hi
I have the reindex script configured to fire the reindex process on Jira 4.4 and it works nice.
It is based on something similar to this one: https://answers.atlassian.com/questions/92800/activating-jira-indexing-via-script
#!/bin/sh # This script detects if Jira is suggesting a re-index is necessary # and triggers it if this is the case. # This script is designed to be run from cron THISPROC=`basename $0` # Set our name to the called command name MAILFILE=/tmp/jiramail-$$ echo "[$THISPROC - Version 1.02 - 28-Mar-2012]" | tee ${MAILFILE} echo " " | tee ${MAILFILE} if [[ ${1} == "" ]]; then echo "Need to specify Jira hostname" | tee -a ${MAILFILE} rm $MAILFILE exit fi JIRA_URL=${1} DASHBOARD_PAGE_URL=http://${JIRA_URL}/secure/Dashboard.jspa PROJECT_PAGE_URL=http://${JIRA_URL}/secure/project/ViewProjects.jspa INDEX_PAGE_URL=http://${JIRA_URL}/secure/admin/jira/IndexReIndex.jspa WEBSUDO_PAGE_URL=http://${JIRA_URL}/jira/secure/admin/WebSudoAuthenticate.jspa MAIL_USERS="someuser@somemail.com" COOKIE="/tmp/jiracoookie-$(date +%s)" PASSWORD=$(grep ${JIRA_URL} ~/.netrc | cut -f6 -d" ") echo "$(hostname): Starting Jira reindex $(date)" >> ${MAILFILE} echo " " >> ${MAILFILE} RESULT=$(curl -s -n --cookie-jar ${COOKIE} ${PROJECT_PAGE_URL} | grep "It is recommended that you perform a re-index") if [[ ${RESULT} != "" ]]; then echo " * Re-index required - starting that now *" >> ${MAILFILE} # Set the web sudo token curl -s -n --cookie ${COOKIE} -d "webSudoPassword=${PASSWORD}" $WEBSUDO_PAGE_URL # Kick off the re-index curl -s -n --cookie ${COOKIE} --header "X-Atlassian-Token: no-check" -d "indexPathOption=DEFAULT" -d "Re-Index=Re-Index" -d "indexPath=" --output /dev/null ${INDEX_PAGE_URL} else echo " No need to re-index this time" >> ${MAILFILE} fi cat ${MAILFILE} | mail -s "Jira re-index script - ${JIRA_URL}" ${MAIL_USERS} rm -f ${MAILFILE} ${COOKIE}
This scripts perfectly detects if it necessary to Reindex instance for both Jira 4.4 and Jira 5.2.8 versions but it is failing to start ReIndex process on Jira 5.2.8.
I even tried to add the " -d "indexingStrategy=1" " option for Backround Index in Jira 5 but it does not help at all.
curl -s -n --cookie ${COOKIE} --header "X-Atlassian-Token: no-check" -d "indexPathOption=DEFAULT" -d "Re-Index=Re-Index" -d "indexPath=" --output /dev/null ${INDEX_PAGE_URL}
Does anyone done this and got working script?
Regards,
Areg
Hi Timothy
Here is the part of curl output where it says about reindexing:
<p>Jira made configuration changes in section 'Plugins' at 20/May/13 9:46 AM. It is recommended that you perform a re-index. For more information, please click the Help icon.<p>To perform the re-index now, please go to the '<a href='/secure/admin/jira/IndexAdmin.jspa'>Indexing</a>' section.<p>Note: So that you only have to re-index once, you may wish to complete any other configuration changes before performing the re-index.</div>
The problem is that Reindexing is changed in Jira 5 and it supports background option.
The script is normally detects that reindexing required but can't kick off the reindex ....
Regards,
Areg
From JIRA 6.1 onwards there is a much simpler way to trigger a re-index - by using the REST API:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Why don't you print out the result of the curl for the page. Does it really print out the "It is recommended that you perform a re-index" text?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.