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

Jiri Pejchal commented on SOLR-9769:
------------------------------------

>There is quite a bit of room for the exit codes being regularized.

Just a note - there are actually two scripts: {{init.d/solr}} and {{bin/solr}}.

The linux Linux Standard Base specifies exit codes for sysvinit init.d scripts:
https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html

Also nowadays systemd has mostly replaced sysvinit init.d scripts.

> 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