Start apache solr service at cpanel hosted site
How can I start apache solr's start.jar o开发者_如何转开发n my webspace having cpanel? I cant access the shell as the link to open the shell is also missing, probably the only solution could be to put some script in the batch file to which i am not sure. Any suggestions?
It should run like any other program, though port 8080 may be blocked, and you may need your own IP address on the server to let java bind to it, and the system admins may get mad about java, and you may also need to change the path to java.
This is how I have solr running on my cpanel server:
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.55.x86_64/jre/bin/java -server -Xms1024m -Xmx1024m -XX:+UseParallelGC -XX:NewRatio=5 -Dsolr.solr.home=/home/user/solr/ -Djetty.logs=/home/user/solr/jetty/logs -Djetty.home=/home/user/solr/jetty -jar /home/user/solr/jetty/start.jar /home/user/solr/jetty/etc/jetty.xml
You should have an option to run cron jobs, and can use that to startup solr if it is not running. Here is one that may work:
#!/bin/sh
STATUS=$(ps faux | grep java | grep solr | wc -l)
echo $STATUS
if [ "$STATUS" == "1" ]
then
echo "notdead"
echo "$(date) Running" >> ~/solr.cron.log
else
(/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.55.x86_64/jre/bin/java -server -Xms1024m -Xmx1024m -XX:+UseParallelGC -XX:NewRatio=5 -Dsolr.solr.home=/home/user/solr/ -Djetty.logs=/home/user/solr/jetty/logs -Djetty.home=/home/user/solr/jetty -jar /home/user/solr/jetty/start.jar /home/user/solr/jetty/etc/jetty.xml & ) &
echo "Dead"
echo "$(date) Restarting" >> ~/solr.cron.log
fi
精彩评论