[ 
https://issues.apache.org/jira/browse/SOLR-9769?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16826209#comment-16826209
 ] 

Erick Erickson commented on SOLR-9769:
--------------------------------------

I come down on the side of reporting an error if Solr is already stopped. 

{quote}
What should be considered a success when calling stop? When I am calling stop I 
want to make sure that solr is not running. That is the state i want to 
transition to. So when solr is not running after calling stop that is a 
success. When after calling stop solr is still running that is a failure.
{quote}

The place this argument falls down is when, say, I want to stop a particular 
Solr on a particular port and don't enter the proper port. Example:  'bin/solr 
stop -p 8984' but Solr is running on 8983. I am _not_ in the state I intend, 
which is that my Solr running on port 8983 is stopped. At least when an error 
is reported because no solr is running on 8984 I have a clue that the result I 
wanted isn't the result I got.

There is quite a bit of room for the exit codes being regularized. This is not 
a change I'd encourage though.



> solr stop on a service already stopped should return exit code 0
> ----------------------------------------------------------------
>
>                 Key: SOLR-9769
>                 URL: https://issues.apache.org/jira/browse/SOLR-9769
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: scripts and tools
>    Affects Versions: 6.3
>            Reporter: Jiří Pejchal
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> According to the LSB specification
> https://refspecs.linuxfoundation.org/LSB_4.0.0/LSB-Core-generic/LSB-Core-generic.html#INISCRPTACT
>  running stop on a service already stopped or not running should be 
> considered successful and return code should be 0 (zero).
> Solr currently returns exit code 1:
> {code}
> $ /etc/init.d/solr stop; echo $?
> Sending stop command to Solr running on port 8983 ... waiting up to 180 
> seconds to allow Jetty process 4277 to stop gracefully.
> 0
> $ /etc/init.d/solr stop; echo $?
> No process found for Solr node running on port 8983
> 1
> {code}
> {code:title="bin/solr"}
> if [ "$SOLR_PID" != "" ]; then
>     stop_solr "$SOLR_SERVER_DIR" "$SOLR_PORT" "$STOP_KEY" "$SOLR_PID"
>   else
>     if [ "$SCRIPT_CMD" == "stop" ]; then
>       echo -e "No process found for Solr node running on port $SOLR_PORT"
>       exit 1
>     fi
>   fi
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to