You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Erik Hatcher (JIRA)" <ji...@apache.org> on 2019/04/23 13:12:00 UTC
[jira] [Commented] (SOLR-13422) bin/post command not working when
run from crontab
[ https://issues.apache.org/jira/browse/SOLR-13422?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16824121#comment-16824121 ]
Erik Hatcher commented on SOLR-13422:
-------------------------------------
Carsten - thanks for filing this. I'll take ownership of it, with the caveat that I don't know when I'll get to tackling this myself; given the reasonable workaround, I'll keep this on the back burner. I've only ever run `bin/post` interactively myself, so I haven't yet experienced this myself - sorry for letting this one go unnoticed til now.
> bin/post command not working when run from crontab
> --------------------------------------------------
>
> Key: SOLR-13422
> URL: https://issues.apache.org/jira/browse/SOLR-13422
> Project: Solr
> Issue Type: Bug
> Security Level: Public(Default Security Level. Issues are Public)
> Components: scripts and tools
> Affects Versions: 7.5, 7.7.1
> Reporter: Carsten Agger
> Assignee: Erik Hatcher
> Priority: Major
> Labels: features
>
> I'm working with a script where I want to send a command to delete all elements in an index; notably,
>
> /opt/solr/bin/post -c <my collection> -d "<delete><query>*:*</query></delete>"
>
> When run interactively, this works fine.
> However, when run automatically as a cron job, it gives this interesting output:
> Unrecognized argument: "<delete><query>*:*</query></delete>"
> If this was intended to be a data file, it does not exist relative to /root
> The culprit seems to be these lines, 143-148:
> if [[ ! -t 0 ]]; then
> MODE="stdin"
> else
> #when no stdin exists and -d specified, the rest of the arguments
> #are assumed to be strings to post as-is
> MODE="args"
>
> This code seems to be doing the opposite of what the comment says - it sets MODE="stdin" if stdin is NOT a terminal, but if it IS (i.e., there IS an stdin) it assumes the rest of the args can be posted as-is.
> On the other hand, if the condition is reversed, my command will fail interactively but not when run as a cron job. Both options are, of course, unsatisfactory.
> It _will_ actually work in both cases, if instead the command to delete the contents of the index is written as:
> echo "<delete><query>*:*</query></delete>" | /opt/solr/bin/post -c departments -d
> I've confirmed this bug in SOLR v. 7.7.1 and 7.5 - it is presumably present in more versions.
> I've raised the issue on the solr-user mailing list, where I was asked to file a Jira report.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org