I need to know if there is any way to trigger indexing on Jira 3.13.4 via Curl / WGET.
I preface this with saying I have not even tried, but I am under a timeline and wanted to at least get the question out there before I start researching in case there is a known solution.
Thanks in advance.
Community moderators have prevented the ability to post new answers.
Updates:
Good shot, Jason. :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can confirm that the reindex.sh script is still working on RHEL 7 and Jira 6.4.x
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes and No. I cannot attest to RHEL 7 support as we are still on RHEL6 but, the shell script was written with bash as shell and curl as the only dependence so, I would expect it to run from any distro or proably even cygwin. Version 6.4.x changed the rest-api to return a taskid and progress url. The script will work with 6.4 to start an index but, cannot monitor progress as of now. Additionally, as pointed out by @Chris Solgat they added an acknowledge url return as well to clear the notice in Jira gui that an index has completed. I have made code changes and am testing now. I will update later today with a new shell script.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I ran the script earlier after tailoring it to our system and it is still getting the status and reporting it to the console every 5 seconds as the script was designed to do. So far even with the updates to rest and whatnot this script is still fully functional on our current RHEL 7/Jira 6.4.x instance that we have setup. Updating the script will be nice to take advantage of new functionality but for anyone reading this thread that needs to get something up and running quickly can still use this script. Good work on it and have a great day!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Jason Hensler have you modified the perl script to do the acknowledge the re-index in PERL script. I saw Chris Solgat has that code shell script but looking same in perl in your script. Can you help me on that piece of code?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have you updated this for JDC 7+?
Can it push the index to the other nodes in the cluster?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We have updated our script for JIRA Software 7.1, JIRA Software 7.3.1, and JIRA Software 7.6.1. The code itself didn't really change, but the parsing of the http responses did. They added a couple extra fields to the http response, so the cutting/parsing of the response does need to be updated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Chris, would you mind posting the changed portions of the script here? It will save some time for JIRA later versions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Jason Hensler
I have taken your bash script and made a few modifications to it. Hopefully it will help someone else. I have tested this on JIRA 6.3.15 and it seems to work very well.
I'm not sure when they made the change that each re-index would get a unique task id, but this helps with that as well. I've been running into an issue in my environment where it seems as though a connection is not closing. I think it's been coming from the re-indexing being run by a script. When you run it through the UI, after it completes, there is an Acknowledge button that appears. I've asked around a little, and was told that this is essentially an insignificant piece. In JIRA 6.3.15, if you know what the re-indexing task id was, you can go back and view the re-indexing complete page, long after it has completed. You can even run other re-index tasks and still go back to a page 5 re-indexes ago, if the task was never acknowledged. After it has been acknowledged, you will get a "Task not found" error if you try to access the page again. This leads me to believe that it's holding onto something more than nothing. Anyways, I have a support ticket open looking into this specifically. In the mean time, I have modified the script to handle the Acknowledgement, as well as provide a little bit of logging information.
#!/bin/sh LOG_FILE="{path to your log directory}/log/reindex.log" exec 3>&1 1>>${LOG_FILE} 2>&1 username="username" password="pass" server="https://jira:port/jira" background=false monitor=true debug=0 echo echo "$(date +%Y-%m-%d_%T) Kicking off re-index..." if [[ "$background" == "true" ]]; then output=`curl -D- -s -S -k -u $username:$password -X POST -H "Content-Type: application/json" "${server}/rest/api/2/reindex"` if [[ $? != 0 ]]; then echo Looks like curl failed with exit code $?: $! exit 1 fi echo "$(date +%Y-%m-%d_%T) Logged in and started a Background re-index..." else output=`curl -D- -s -S -k -u $username:$password -X POST -H "Content-Type: application/json" "${server}/rest/api/2/reindex?type=FOREGROUND"` if [[ $? != 0 ]]; then echo Looks like curl failed with exit code $?: $! exit 1 fi echo "$(date +%Y-%m-%d_%T) Logged in and started a Foreground re-index..." fi if [[ $debug == 1 ]]; then echo ------------------- Http raw response --------------------------- echo $output echo ------------------- --------------------------- fi until [[ $progress -eq 100 || "$monitor" != "true" ]] do sleep 5 output=`curl -s -S -k -u $username:$password -X GET -H "Content-Type: application/json" "${server}/rest/api/2/reindex" ` if [[ $debug == 1 ]]; then echo ------------------- Http raw response --------------------------- echo $output echo ------------------- --------------------------- fi progress=`echo $output | cut -d "," -f 2 | cut -d ":" -f 2` if [ "$oldprog" != "$progress" ]; then taskid=`echo $output | cut -d "," -f 1 | cut -d ":" -f 2 | cut -d "=" -f 2 | awk '{ print substr( $0, 0, 5) }'` success=`echo $output | cut -d "," -f 7 | cut -d ":" -f 2 | cut -d "}" -f 1` acknowledge="${server}/secure/admin/jira/AcknowledgeTask.jspa?taskId=${taskid}&destinationURL=%2Fsecure%2Fadmin%2Fjira%2FIndexAdmin.jspa%3FreindexTime%3D246&Acknowledge=Acknowledge&atl_token=${atl_token}" echo "$(date +%Y-%m-%d_%T) Index is at ${progress}%..." fi oldprog=$progress done echo "$(date +%Y-%m-%d_%T) Task ID is ${taskid}" echo "$(date +%Y-%m-%d_%T) Success of re-index is ${success}" if [[ $success = "true" && $progress -eq 100 ]]; then echo "$(date +%Y-%m-%d_%T) Re-index completed Successfully, sending Acknowledgement." #echo "Acknowledge URL is ${acknowledge}" output=`curl -s -S -k -u $username:$password -X GET -H "X-Atlassian-Token: no-check" -H "Content-Type: text/html" "${acknowledge}"` if [[ $? != 0 ]]; then echo Looks like curl failed with exit code $?: $! exit 1 fi echo "$(date +%Y-%m-%d_%T) Successfully Acknowledged." if [[ $debug == 1 ]]; then echo ------------------- Http raw response --------------------------- echo $output echo ------------------- --------------------------- fi fi exit 0
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Chris Solgat Chris, I am trying to configure your script to run in my environment. I am running into an error on how the date is parsed (I think). Here is what I am seeing: 2015-07-22_13:39:12 Index is at \"PM\"]%... ./reindex.sh: line 35: [[: \"PM\"]: syntax error: operand expected (error token is "\"PM\"]") I am not very familiar with parsing. Can you give me any help?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Jeanne Howe Did you try running Jason's script. If Jason's does not work for you, it could be the shell that you're using. If you're failing on line 35, it looks like its actually failing on the "progress" variable, not the time. Try Jason's and let me know.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Could you change "debug=0" to "debug=1" and post the output. It looks like the script is picking up the timestamp for the progress variable and the shell is bailing out.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Jason, Chris It is bailing on the progress variable. Here is what the debug out put looks like {code} 2015-07-22_15:58:16 Kicking off re-index... 2015-07-22_15:58:16 Logged in and started a Background re-index... ------------------- Http raw response --------------------------- <html> <head> <title>Unauthorized (401)</title> <!--[if IE]><![endif]--> <script type="text/javascript">var contextPath = '';</script> <script> window.WRM=window.WRM||{};window.WRM._unparsedData=window.WRM._unparsedData||{}; WRM._unparsedData["com.atlassian.plugins.atlassian-plugins-webresource-plugin:context-path.context-path"]="\"\""; WRM._unparsedData["jira.webresources:dateFormatProvider.dateFormat"]="{\"meridiem\":[\"AM\",\"PM\"],\"eras\":[\"BC\",\"AD\"],\"months\":[\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"],\"monthsShort\":[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"],\"weekdaysShort\":[\"Sun\",\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\"],\"weekdays\":[\"Sunday\",\"Monday\",\"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\"]}"; WRM._unparsedData["com.atlassian.jira.ext.calendar:tipDataProvider.tip"]="{\"suppressTip\":false}"; WRM._unparsedData["com.atlassian.jira.jira-header-plugin:dismissedFlags.flags"]="{\"dismissed\":[]}"; WRM._unparsedData["com.atlassian.jira.jira-header-plugin:newsletter-signup-tip.newsletterSignup"]="{\"formUrl\":\"https://www.atlassian.com/apis/exact-target/{0}/subscribe?mailingListId=1239131\",\"showNewsletterTip\":false}"; WRM._unparsedData["com.atlassian.jira.plugins.greenhopper-marketing-plugin:gh-advertising-resources.urls"]="{\"hamlet\":\"https://hamlet.atlassian.com/\",\"lasso\":\"https://id.atlassian.com/\",\"mac\":\"https://my.atlassian.com\"}"; WRM._unparsedData["com.atlassian.jira.plugins.jira-admin-helper-plugin:notification-event-provider.notification-event-data"]="[{\"id\":1,\"name\":\"Issue Created\",\"isDefault\":true},{\"id\":2,\"name\":\"Issue Updated\"},{\"id\":3,\"name\":\"Issue Assigned\"},{\"id\":4,\"name\":\"Issue Resolved\"},{\"id\":5,\"name\":\"Issue Closed\"},{\"id\":6,\"name\":\"Issue Commented\"},{\"id\":14,\"name\":\"Issue Comment Edited\"},{\"id\":17,\"name\":\"Issue Comment Deleted\"},{\"id\":7,\"name\":\"Issue Reopened\"},{\"id\":8,\"name\":\"Issue Deleted\"},{\"id\":9,\"name\":\"Issue Moved\"},{\"id\":10,\"name\":\"Work Logged On Issue\"},{\"id\":11,\"name\":\"Work Started On Issue\"},{\"id\":12,\"name\":\"Work Stopped On Issue\"},{\"id\":15,\"name\":\"Issue Worklog Updated\"},{\"id\":16,\"name\":\"Issue Worklog Deleted\"},{\"id\":13,\"name\":\"Generic Event\"},{\"id\":10001,\"name\":\"event.type.jemhpost-creationevent.name\"}]"; WRM._unparsedData["com.atlassian.jira.plugins.jira-admin-helper-plugin:permissions-provider.permissions-data"]="[{\"permissions\":[{\"name\":\"Administer Projects\",\"id\":\"23\"},{\"name\":\"Browse Projects\",\"id\":\"10\"},{\"name\":\"View Development Tools\",\"id\":\"29\"},{\"name\":\"View Read-Only Workflow\",\"id\":\"45\"}],\"name\":\"Project Permissions\"},{\"permissions\":[{\"name\":\"Create Issues\",\"id\":\"11\"},{\"name\":\"Edit Issues\",\"id\":\"12\"},{\"name\":\"Transition Issues\",\"id\":\"46\"},{\"name\":\"Schedule Issues\",\"id\":\"28\"},{\"name\":\"Move Issues\",\"id\":\"25\"},{\"name\":\"Assign Issues\",\"id\":\"13\"},{\"name\":\"Assignable User\",\"id\":\"17\"},{\"name\":\"Resolve Issues\",\"id\":\"14\"},{\"name\":\"Close Issues\",\"id\":\"18\"},{\"name\":\"Modify Reporter\",\"id\":\"30\"},{\"name\":\"Delete Issues\",\"id\":\"16\"},{\"name\":\"Link Issues\",\"id\":\"21\"},{\"name\":\"Set Issue Security\",\"id\":\"26\"}],\"name\":\"Issue Permissions\"},{\"permissions\":[{\"name\":\"View Voters and Watchers\",\"id\":\"31\"},{\"name\":\"Manage Watchers\",\"id\":\"32\"}],\"name\":\"Voters & Watchers Permissions\"},{\"permissions\":[{\"name\":\"Add Comments\",\"id\":\"15\"},{\"name\":\"Edit All Comments\",\"id\":\"34\"},{\"name\":\"Edit Own Comments\",\"id\":\"35\"},{\"name\":\"Delete All Comments\",\"id\":\"36\"},{\"name\":\"Delete Own Comments\",\"id\":\"37\"}],\"name\":\"Comments Permissions\"},{\"permissions\":[{\"name\":\"Create Attachments\",\"id\":\"19\"},{\"name\":\"Delete All Attachments\",\"id\":\"38\"},{\"name\":\"Delete Own Attachments\",\"id\":\"39\"}],\"name\":\"Attachments Permissions\"},{\"permissions\":[{\"name\":\"Work On Issues\",\"id\":\"20\"},{\"name\":\"Edit Own Worklogs\",\"id\":\"40\"},{\"name\":\"Edit All Worklogs\",\"id\":\"41\"},{\"name\":\"Delete Own Worklogs\",\"id\":\"42\"},{\"name\":\"Delete All Worklogs\",\"id\":\"43\"}],\"name\":\"Time Tracking Permissions\"}]"; WRM._unparsedData["com.atlassian.jira.plugins.jira-dnd-attachment-plugin:drag-and-drop-attachment-javascript.upload-limit"]="\"304857600\""; WRM._unparsedData["com.atlassian.plugins.browser.metrics.browser-metrics-plugin:browser-metrics.feature-data-provider-legacy"]="true"; WRM._unparsedData["com.atlassian.plugins.helptips.jira-help-tips:common.JiraHelpTipData"]="{\"anonymous\":true}"; WRM._unparsedData["com.atlassian.plugins.jira-html5-attach-images:jira-html5-attach-images-resources.resource-uris"]="{\"deployJava.html\":\"/s/en_US9gafw3/64020/104/1.5.27/_/download/resources/com.atlassian.plugins.jira-html5-attach-images:jira-html5-attach-images-resources/deployJava.html\",\"clipboard.jar\":\"/s/en_US9gafw3/64020/104/1.5.27/_/download/resources/com.atlassian.plugins.jira-html5-attach-images:jira-html5-attach-images-resources/clipboard.jar\",\"clipboard-legacy.jar\":\"/s/en_US9gafw3/64020/104/1.5.27/_/download/resources/com.atlassian.plugins.jira-html5-attach-images:jira-html5-attach-images-resources/clipboard-legacy.jar\"}"; WRM._unparsedData["com.atlassian.pocketknife.featureflags-plugin:pocketknife-feature-flags.feature-flag-data"]="{\"enabled-feature-keys\":[\"com.atlassian.jira.projects.issuenavigator\",\"com.atlassian.jira.projects.ProjectCentricNavigation.Switch\",\"jira.plugin.devstatus.phasetwo.enabled\",\"com.atlassian.jira.config.PDL\",\"jira.frother.reporter.field\",\"jira.plugin.devstatus.phasetwo\",\"com.atlassian.jira.darkfeature.CommonHeader\",\"app-switcher.new\",\"frother.assignee.field\",\"jira.issue.status.lozenge\"],\"feature-flag-states\":{\"sd.confluence.kb.od.oneclick\":true,\"sd.test.feature.flag.x\":true,\"sd.test.feature.flag.y\":false,\"sd.shared.portals.kb.search\":true,\"sd.skate.upgrade\":true,\"sd.reporter.internal.comments.async.upgrade\":true,\"sd.experimental.customer.satisfaction\":false,\"sd.advance.portal.branding.portal.content\":false,\"sd.request.type.search.advance\":false,\"sd.experimental.itil.sd.configuration\":false,\"sd.agent.invite.customers\":true,\"sd.better.logo.uploader\":true,\"sd.global.portal.rt.search\":false,\"sd.shared.portals.kb.like\":true,\"sd.shared.portals.redo\":true,\"sd.advance.portal.branding\":true,\"sd.channel.issue.properties.async.upgrade\":true,\"sd.agent.queue.update\":true,\"sd.req.participants.portal\":true,\"sd.agent.signature\":false,\"sd.sla.threshold.events\":true,\"sd.request.participants\":true,\"sd.req.participants.email\":true,\"sd.email.notification.quoted.reply.stripping\":false,\"sd.email.notification.plain.text\":true,\"sd.portal.logo.default\":true,\"sd.agent.queue.dynamic.update\":true,\"sd.automation.settings.page\":true,\"sd.request.participants.upgrade\":true,\"sd.jira.automation.event\":false,\"sd.remove.logo.roundness\":true,\"sd.admin.permission.migration.complete\":false,\"sd.global.portal.search.atlassian.only.tracking\":false,\"sd.email.platform.integration\":true,\"com.atlassian.jira.config.CoreFeatures.LICENSE_ROLES_ENABLED\":false}}"; WRM._unparsedData["com.atlassian.servicedesk:sd-help-links.help-links"]="{\"help\":{\"legacy.transition.deprecated\":\"http://docs.atlassian.com/servicedesk/docs-025/Legacy+comment+transition\",\"troubleshoot.requesttype\":\"http://docs.atlassian.com/servicedesk/docs-025/Troubleshooting+issues+with+request+types\",\"public.signup\":\"http://docs.atlassian.com/servicedesk/docs-025/Configuring+public+signup\",\"troubleshooting.user.management.issues\":\"http://docs.atlassian.com/servicedesk/docs-025/Troubleshooting+issues+with+user+management\",\"admin.notifications.config\":\"http://docs.atlassian.com/servicedesk/docs-025/Configuring+JIRA+Service+Desk+notifications\",\"resolve.permission.scheme.errors\":\"http://docs.atlassian.com/servicedesk/docs-025/Resolving+permission+scheme+errors\",\"default\":\"http://docs.atlassian.com/servicedesk/docs-025/\",\"request.type.error.learn.more\":\"http://docs.atlassian.com/servicedesk/docs-025/Troubleshooting+issues+with+request+types\",\"email.setup\":\"http://docs.atlassian.com/servicedesk/docs-025/Setting+up+the+email+channel\"},\"kb\":{\"default\":\"https://confluence.atlassian.com/display/SDKB/\",\"legacytransition\":\"https://confluence.atlassian.com/display/SDKB/Replacing+legacy+automatic+transitions+with+automation+rules\"}}"; WRM._unparsedData["com.atlassian.servicedesk:sd-license-warning-resource.exceeded-data"]="{\"isOndemand\":false}"; </script> <link type="text/css" rel="stylesheet" href="/s/e1d516f0a4fe012a178b1199b806ca59-CDN/en_US9gafw3/64020/104/104/_/download/superbatch/css/batch.css" media="all"> <!--[if lte IE 9]> <link type="text/css" rel="stylesheet" href="/s/ede1f147ca45bb7ab88c769eeb329330-CDN/en_US9gafw3/64020/104/104/_/download/superbatch/css/batch.css?conditionalComment=lte+IE+9" media="all"> <![endif]--> <link type="text/css" rel="stylesheet" href="/s/57d33162ceeb4737d979b281ad082ad8-CDN/en_US9gafw3/64020/104/f4e82ce632c501799dd2979ab8d96fb3/_/download/contextbatch/css/atl.general,jira.global,jira.general/batch.css?jag_disabled_marketing=true" media="all"> <link type="text/css" rel="stylesheet" href="/s/1de7d13d6350075759f5dbb50e596fe1-CDN/en_US9gafw3/64020/104/5.7.27/_/download/batch/com.atlassian.auiplugin:dialog2/com.atlassian.auiplugin:dialog2.css" media="all"> <link type="text/css" rel="stylesheet" href="/s/d41d8cd98f00b204e9800998ecf8427e-T/en_US9gafw3/64020/104/6.2.1.2/_/download/batch/com.metainf.jira.plugin.emailissue:emailissue-web-resource6/com.metainf.jira.plugin.emailissue:emailissue-web-resource6.css" media="all"> <script type="text/javascript" src="/s/a552c0308a3fa15a8ec02787e026318b-CDN/en_US9gafw3/64020/104/104/_/download/superbatch/js/batch.js?locale=en-US" ></script> <script type="text/javascript" src="/s/34b930dabb0049fd35bf17e729badf38-CDN/en_US9gafw3/64020/104/f4e82ce632c501799dd2979ab8d96fb3/_/download/contextbatch/js/atl.general,jira.global,jira.general/batch.js?locale=en-US&jag_disabled_marketing=true" ></script> <script type="text/javascript" src="/s/d41d8cd98f00b204e9800998ecf8427e-CDN/en_US9gafw3/64020/104/5.7.27/_/download/batch/com.atlassian.auiplugin:internal-aui-browser/com.atlassian.auiplugin:internal-aui-browser.js" ></script> <script type="text/javascript" src="/s/d41d8cd98f00b204e9800998ecf8427e-CDN/en_US9gafw3/64020/104/5.7.27/_/download/batch/com.atlassian.auiplugin:dialog2/com.atlassian.auiplugin:dialog2.js" ></script> <script type="text/javascript" src="/s/970538c65b124f864b514ddb8fb92adf-T/en_US9gafw3/64020/104/6.2.1.2/_/download/batch/com.metainf.jira.plugin.emailissue:emailissue-web-resource6/com.metainf.jira.plugin.emailissue:emailissue-web-resource6.js?content-type=text%2Fjavascript&locale=en-US" ></script> <script type="text/javascript" src="/rest/api/1.0/shortcuts/64020/f7b342512c8ef641f85e4c6693f33eef/shortcuts.js"></script> <meta name="application-name" content="JIRA" data-name="jira" data-version="6.4.5"> </head> <body id="jira" class="aui-layout aui-style-default page-type-message" data-version="6.4.5" > <div class="aui-page-panel"><div class="aui-page-panel-inner"> <section class="aui-page-panel-content"> <header class="aui-page-header"><div class="aui-page-header-inner"> <div class="aui-page-header-main"> <h1>Unauthorized (401)</h1> </div><!-- .aui-page-header-main --> </div><!-- .aui-page-header-inner --></header><!-- .aui-page-header --> <div class="aui-message aui-message-warning warning"> <p>Encountered a <code>"401 - Unauthorized"</code> error while loading this page.</p> <p><a href="/secure/MyJiraHome.jspa">Go to JIRA home</a></p> </div> </section><!-- .aui-page-panel-content --> </div><!-- .aui-page-panel-inner --></div><!-- .aui-page-panel --> </body> </html> {code}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
First thing that jumps out to me, you are getting a 401 - Unauthorized error. Did you make sure that the user ID has access to run a re-index, and make sure that the password is spelled correctly?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
One other thing I forgot to ask, which version of Jira are you using this for? I have only tested this with Jira 6.3.15.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The user ID and password are correct. We are on v6.4.5. I think the issue may be in this line: output=`curl -s -S -k -u $username:$password -X GET -H "Content-Type: application/json" "https://jira01ap:8080/jira/rest/api/2/reindex"; ` I modified the line to point to my dev environment. When I run Jason's script I get: curl: (6) Couldn't resolve host 'jiradev'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I was just going to add a comment to this. Since you are using https and a port number you need to make sure that you have the correct port number. Usually 8080 is only for http, not https. If your Jira is using https, there should be a redirect port number that is being used. If you're not using https, just use http in your URL.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is what a proper response should look like -- 2015-07-22_16:02:12 Kicking off re-index... 2015-07-22_16:02:12 Logged in and started a Background re-index... ------------------- Http raw response --------------------------- {"progressUrl":"/secure/admin/jira/IndexProgress.jspa?taskId=10401","currentProgress":0,"type":"BACKGROUND","submittedTime":"2015-07-22T16:02:12.864-0500","success":false} ------------------- ---------------------------
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Chris, I have gotten Jason's script to run! thank you for all the help. The issue was in my URL format.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Chris Solgat did you ever get an answer to your question about the tasks being held onto?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Adam White
Yes, but there's not a lot to it. You can read the accepted answer for What is the importance of the Acknowledge button after re-index?
The answer I received from Support is almost exactly the same:
If you don't press the Acknowledge button, JIRA simply holds that acknowledgement page in its cache. Once the acknowledgement is submitted, the system redirects you back to the indexing page and displays some basic information about the indexing task. All of that information is stored in cache. This functionality has no bearing on the actual indexing functionality itself other than kick off the task and monitor its progress. Since JIRA's task manager allows for only one background or foreground index task to occur at a time, you don't have to worry that there are multiple indexing sessions going on. The system does not need feedback from the UI to complete.
So, the system is holding onto something when you don't click the Acknowledge button, but it is just holding on to some lightweight page information in the cache.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For those running JIRA 6.1 or later, it is possible to trigger a re-index via the REST API, with a single command such as the example below (needs JIRA Admin permission):
$ curl -D- -u <user>:<password> -X POST -H "Content-Type: application/json" "http://JIRA_URL:JIRA_PORT/rest/api/2/reindex"
Source:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Danilo, would you have something similar for confluence? my curl command used to work for confluence prior to the upgrade ( from v5.6 to v6.3)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
David,
This question seems to come up quite a bit. There's a number of different ways to do it, I don't have specifics for Windows, but maybe these will help:
https://answers.atlassian.com/questions/79403/how-to-set-up-auto-re-index-in-jira
https://confluence.atlassian.com/display/JIRACOM/Automating+JIRA+operations+via+wget
https://marketplace.atlassian.com/plugins/org.swift.jira.cli
The JIRA Command Line Interface does support JIRA 3.13, but I don't know if re-indexing is available that far back. You'll have to review the docs to see. Note, you'll want to donwload the correct version that is compatible for 3.13. See version history on the linked page in the marketplace.
Best
Adam Saint-Prix
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use this url:
https://jirainstall/secure/admin/jira/IndexReIndex.jspa?os_username=user&os_password=pass
The older versions didn't have auth toakens like the new versions do.
I don't have curl installed but I think the command would be:
curl -k "https://jirainstall/secure/admin/jira/IndexReIndex.jspa?os_username=user&os_password=pass"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Julian. Your script works just fine with JIRA 5.2.4 right now.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here is my script:
#!/usr/bin/perl ################################################################################### # Re-Index.pl by Jason Hensler # Starts re-index job for jira. Tested with JIra 5.2.4 and 6.0.7 ################################################################################### #disable ssl verfication, using this for self-signed cert otherwise comment out. $ENV{'PERL_LWP_SSL_VERIFY_HOSTNAME'} = 0; use warnings; use diagnostics; use Data::Dumper; use LWP::UserAgent; # Change these my $user = "*****"; my $pass = "******"; my $jira_url = "https://*************************/"; my $cookie_jar = $ENV{'HOME'}; #change this if you need to, should only be need is there is a permissions issue. my $index_type = 1; #This is for jira 5.2 and above. Set to 1 for background re-index or 0 for locking index. my $error = 0; #setup initial connection paramaters my $status; print("Creating connection to [$jira_url]... \n"); my $ua = LWP::UserAgent->new; $ua->cookie_jar({ file => "$cookie_jar/\.cookies.txt" }); $ua->default_header('X-Atlassian-Token' => 'no-check'); #do login $status = $ua->post($jira_url.'secure/admin/IndexAdmin.jspa', [ 'os_username' => $user, 'os_password' => $pass]); if($status->header('X-Seraph-LoginReason') eq "AUTHENTICATED_FAILED" || $status->code !=200) {die("Could not login to jira, verify username and password!\n");} else { print("Successfully logged in to Jira.\n"); #do websudo $status = $ua->post($jira_url.'secure/admin/WebSudoAuthenticate.jspa',[ 'webSudoPassword' => $pass]); # I'm using the http code here because the user header check stays ok and I didn't want to grep the output for an error... # If we pass sudo check we get redirected to /secure/ and code is 302, otherwise we get served an error page with status 200 if($status->code != 302) { unlink('$cookie_jar/.cookies.txt'); print("We did not sudo properly, check that your password is good and the your user is an admin!\n"); $error = 1; } else { print("Successfully passed websudo, kicking off indexing... "); #do re-index if($index_type == 1) {$index_type='background';} $status = $ua->post($jira_url.'IndexReIndex.jspa', [ 'indexPathOption' => 'DEFAULT','Re-Index' =>'Re-Index', 'indexingStrategy' => $index_type]); if($status->code != 302) { print("Could not start re-index, check that your password is good and the your user is an admin!\n"); $error = 1; } else { print("Re-index has started.\n"); print ("Task url: ".$status->header('location')."\n"); my $finished = 0; my $temp_file = "out.html"; while ($finished eq 0) { my $progress = $ua->mirror($status->header('location'),$temp_file); sleep(5); open(my $tmp, "<", $temp_file); while(eof($tmp) != 1) { my $line = readline($tmp); $line =~ s/^\s+|\s+$//g; #print($line); if ( substr($line,0,15) eq "Re-indexing is ") { print ("Reindex is at ".substr($line,15,3)."\n"); if(substr($line,15,3) eq "100") { $finished = 1; print ("DONE!\n"); } } } unlink($temp_file); sleep(5); } $error = 0; } } } unlink('$cookie_jar/.cookies.txt'); exit $error;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
At jira 6.2 i get:
Creating connection to [https://**********************/]... Use of uninitialized value in string eq at reindex_test.pl line 34 (#1) (W uninitialized) An undefined value was used as if it were already defined. It was interpreted as a "" or a 0, but maybe it was a mistake. To suppress this warning assign a defined value to your variables. To help you figure out what was undefined, perl will try to tell you the name of the variable (if any) that was undefined. In some cases it cannot do this, so it also tells you what operation you used the undefined value in. Note, however, that perl optimizes your program anid the operation displayed in the warning may not necessarily appear literally in your program. For example, "that $foo" is usually optimized into "that " . $foo, and the warning will refer to the concatenation (.) operator, even though there is no . in your program. Uncaught exception from user code: Could not login to jira, verify username and password!
What do i wrong?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the fast reply!!!!
Stealing pieces of this discussion as I'm trying to get this to work with wget still not success
IE:
wget --header "X-Atlassian-Token: no-check" http://hostname:8080/secure/admin/jira/IndexReIndex.jspa?os_username=xxxxx&os_password=xxxx
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try:
wget --header "X-Atlassian-Token: no-check"http://hostname:8080/jira/secure/admin/IndexReIndex.jspa?os_username=xxxxx&os_password=xxxx
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your quick replies, I'm wanting to continue this discussion but I'm out of the office for 2 weeks. I'm leaving this w/ errors like I cannot get beyond security
2013-12-12 15:50:07,630 http-bio-8080-exec-6 INFO anonymous 950x219x1 - 10.32.114.67 /secure/admin/jira/IndexReIndex.jspa [jira.web.action.XsrfErrorAction] The security token is missing for 'anonymous'. User-Agent : 'curl/7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
How to pass the "lock" option which is the 2nd bullet?
Thanks in advance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you mean you want to "lock" jira durring the re-index, set "my
$index_type
= 0".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
A note for Jira 6.1: The view "AdminSummary.jspa" has gone, you can replace the following to make the script working again:
(...) #do login $status = $ua->post($jira_url.'secure/admin/IndexAdmin.jspa', [ 'os_username' => $user, 'os_password' => $pass]); if($status->header('X-Seraph-LoginReason') eq "AUTHENTICATED_FAILED" || $status->code !=200) {die("Could not login to jira, verify username and password!\n");} (...)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am using the PERL script provided by @Jason Hensler with Jira 5.1.4 and it works very well. My question is how to check the status of reindexing after it's started, specifically, when it finishes.
Does anybody have any ideas on how to do this? I would like to do this in PERL, possibly to add on to the script privided by @Jason Hensler.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
See my edit above.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Did anyone tried to do the curl one under the linux?
The curl version of script requires to do the Websudo login once more ....
<input type="hidden" title="ajaxTimeout" value="The call to the JIRA server did not complete within the timeout period. We are unsure of the result of this operation."> <input type="hidden" title="JiraVersion" value="5.2.8" /> <input type="hidden" title="ajaxUnauthorised" value="You are not authorised to perform this operation. Please log in.">
Regards,
Areg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did not work how?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, do you have your JIRA with OnDemand, is it self hosted or hosted by another company? This Windows batch script assumes that JIRA is installed in D:\Jira\JIRA-Enterprise-3.13.4 suggesting it's a Windows machine, but if it's hosted by another provider it might not be. Is the version of JIRA correct?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The version is correct sadly.
Yes, this is Windows hosted (I Control the host), and the paths are correct.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I did come across this windows batch script (it uses windows based curl which I already have), but I tried against my hosted atlassian instance (granted it is a special case) but it did not work. Any comments?
set USERNAME= set PASSWORD= set INDEX_PATH=D:\Jira\JIRA-Enterprise-3.13.4\indexes set DASHBOARD_PAGE_URL=http://<JIRA_URL>/secure/Dashboard.jspa set INDEX_PAGE_URL=http://<JIRA_URL>/secure/admin/jira/IndexReIndex.jspa set COOKIE_FILE_LOCATION=jiracoookie.txt curl\curl.exe -k -s --head -u %USERNAME%:%PASSWORD% --cookie-jar %COOKIE_FILE_LOCATION% %DASHBOARD_PAGE_URL% curl\curl.exe -k -s --cookie %COOKIE_FILE_LOCATION% --header "X-Atlassian-Token: no-check" -d "indexPathOption=DEFAULT" -d "Re-Index=Re-Index" -d "newIndexPath=%INDEX_PATH%" %INDEX_PAGE_URL% erase %COOKIE_FILE_LOCATION%
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.