The cfsolr script for Mac, Linux, and Unix is written such that you must be in the ColdFusion9/solr/ directory when running the script. The script refers to the start.jar file without providing the full path.
The problem is that if you are not in the solr/ directory under the ColdFusion root directory, the cfsolr script echos that Solr has been started or stopped, even though it has not.
Since the standard error is redirected to the standard out with "2>&1" the problem is swallowed and the person performing the operation is led to believe that the operation has been carried out as expected.
Here's a snippet from the ColdFusion9/solr/cfsolr script showing that start.jar is referenced without a full path:
SOLRSTART='nohup java $JVMARGS -jar start.jar > $SOLR/logs/start.log 2>&1 &' SOLRSTOP='nohup java $JVMARGS -jar start.jar --stop > $SOLR/logs/start.log 2>&1'
Looking at the logs, I see that the problem was quietly recorded in a solr log file:
QAs-iMac:logs QA$ pwd /opt/ColdFusion901/solr/logs QAs-iMac:logs QA$ cat start.log Unable to access jarfile start.jar
The script already has a variable defining the Solr directory path:
SOLR="/opt/ColdFusion9/solr"
To fix the bug, prefix the reference to start.jar with ${SOLR}/start.jar like this:
SOLRSTART='nohup java $JVMARGS -jar ${SOLR}/start.jar > $SOLR/logs/start.log 2>&1 &' SOLRSTOP='nohup java $JVMARGS -jar ${SOLR}/start.jar --stop > $SOLR/logs/start.log 2>&1'
With that fix, the cfsolr script can be called from any directory outside the solr directory.
Here is an examle of how the script falsely echos that the solr server has stopped or started when it has not (determined by grepping for the process):
QAs-iMac:opt QA$ pwd /opt QAs-iMac:opt QA$ ./ColdFusion9/bin/coldfusion stop Stopping ColdFusion 9, please wait Stopping coldfusion server.stopped ColdFusion 9 has been stopped QAs-iMac:opt QA$ ps -ef | grep solr 501 73310 1 0 0:00.25 ?? 0:02.64 /usr/bin/java -XX:+AggressiveOpts -XX:+ScavengeBeforeFullGC -XX:-UseParallelGC -Xmx256m -Dsolr.solr.home=multicore -DSTOP.PORT=8079 -DSTOP.KEY=cfsolrstop -jar start.jar
QAs-iMac:opt QA$ ./ColdFusion9/solr/cfsolr start Starting ColdFusion Solr Server... ColdFusion Solr Server is starting up and will be available shortly. QAs-iMac:opt QA$ ps -ef | grep solr 501 78371 62961 0 0:00.00 ttys000 0:00.00 grep solr QAs-iMac:opt QA$ ps -ef | grep solr 501 78373 62961 0 0:00.00 ttys000 0:00.00 grep solr QAs-iMac:opt QA$ ps -ef | grep solr
|
I just ran into this problem, remembered your tweet about it, and found your blog on it. :)