JIRA: Auto ReIndex

It can be helpful to schedule a reindex of issues after hours (likely when you are asleep!). Here is the shell script that can make that happen:

#!/bin/sh
### SETTINGS ###
USERNAME=<admin_username>
PASSWORD=<password>
DASHBOARD_PAGE_URL=http://<JIRA_URL>/secure/Dashboard.jspa
INDEX_PAGE_URL=http://<JIRA_URL>/secure/admin/jira/IndexReIndex.jspa
COOKIE_FILE_LOCATION=jiracoookie
### COMMANDS ###
curl -u $USERNAME:$PASSWORD --cookie-jar $COOKIE_FILE_LOCATION --output /dev/null $DASHBOARD_PAGE_URL
curl --cookie $COOKIE_FILE_LOCATION --header "X-Atlassian-Token: no-check" -d "indexPathOption=DEFAULT" -d "Re-Index=Re-Index" -d "indexPath=" --output /dev/null $INDEX_PAGE_URL
rm $COOKIE_FILE_LOCATION
Advertisements
  1. #2 by Brian S on November 22, 2011 - 4:12 pm

    It’s simple, and works

  2. #3 by Manish on January 19, 2012 - 7:24 am

    Hi.

    I want to use this code to do reindexing automatically. Could you please let me know what are the steps that i need to take to make it going?

    hope to hear soon from you.

    Thank you!!

  3. #4 by Andrew on July 26, 2012 - 9:02 pm

    Have you got this script working in JIRA5? I’ve tried using this script with 5.0.6 but cannot get it to re-index.

    • #5 by Justin on August 22, 2012 - 8:30 pm

      I have not used JIRA 5 yet, so I do not know the answer.

  4. #6 by HP on December 4, 2012 - 11:10 am

    Any one success to run it in jira 5.* ? Please advise

    • #7 by Justin on December 4, 2012 - 1:55 pm

      I haven’t tried this in JIRA 5.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: