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

Shawn Heisey commented on SOLR-9769:
------------------------------------

I see your point, and offer the following:

If Solr is already stopped, and you try to stop it again, that is actually an 
error condition.  The script cannot complete the requested action ... so one 
way of interpreting that is an error ... though some would say that since the 
service is in fact stopped, it's successful.  I think it should be reported as 
an error.

Perhaps what should happen here is the exit code should be 1 if Solr is already 
stopped, and 2 or higher if there's something that could be classified as more 
of a "real" problem.

As a workaround until we decide exactly what to do about this error report, you 
should investigate whether the "do something" part of your script can be done 
while Solr is running, and use "/etc/init.d/solr restart" instead after it's 
done.  Because most unix and unix-like platforms allow you to delete files that 
are currently held open, there's a good chance that whatever you want to do can 
be done while Solr is running.  I cannot guarantee this, of course.  If we find 
that the restart action doesn't work when the service is already stopped, I 
think that qualifies as a bug.


> 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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to