服务neo4j-service启动/停止脚本

时间:2016-06-16 10:08:50

标签: neo4j

我在linux服务器上安装了neo4j,它运行正常。我想为neo4j创建一个服务来启动和停止它。

DESC="Neo4J SERVICE" 
NAME=neo4j-service

do_start()
{
   echo "starting!";
   ./data/neo4j/bin/neo4j console
}
do_stop()
{
  echo "stopping!"
}
case "$1" in
 start)
  do_start
   ;;
 stop)
  do_stop
   ;;
esac
exit 0

我想一步一步走。我正在使用Java 8.现在这只是为了启动服务。如果我运行这个脚本,我得到,

starting!
WARNING: Max 1024 open files allowed, minimum of 40 000 recommended. See the Neo4j manual.
Starting Neo4j Server console-mode...
which: no java in (/sbin:/usr/sbin:/bin:/usr/bin)
ERROR: Unable to find java. (Cannot execute )
* Please use Oracle(R) Java(TM) 7 or OpenJDK(TM) to run Neo4j Server.
* Please see http://docs.neo4j.org/ for Neo4j Server installation instructions.

但是当我在腻子中给出“./bin/neo4j console”时,它运行正常。 这是'update-alternatives --display java'的输出,

java - status is manual.
link currently points to /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java - priority 16000
slave keytool: /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/keytool
slave orbd: /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/orbd
slave pack200: /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/pack200
slave rmid: /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/rmid
slave rmiregistry: /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/rmiregistry
slave servertool: /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/servertool
slave tnameserv: /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/tnameserv
slave unpack200: /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/unpack200
slave jre_exports: /usr/lib/jvm-exports/jre-1.6.0-openjdk.x86_64
slave jre: /usr/lib/jvm/jre-1.6.0-openjdk.x86_64
slave java.1.gz: /usr/share/man/man1/java-java-1.6.0-openjdk.1.gz
slave keytool.1.gz: /usr/share/man/man1/keytool-java-1.6.0-openjdk.1.gz
slave orbd.1.gz: /usr/share/man/man1/orbd-java-1.6.0-openjdk.1.gz
slave pack200.1.gz: /usr/share/man/man1/pack200-java-1.6.0-openjdk.1.gz
slave rmid.1.gz: /usr/share/man/man1/rmid-java-1.6.0-openjdk.1.gz
slave rmiregistry.1.gz: /usr/share/man/man1/rmiregistry-java-1.6.0-openjdk.1.gz
slave servertool.1.gz: /usr/share/man/man1/servertool-java-1.6.0-openjdk.1.gz
slave tnameserv.1.gz: /usr/share/man/man1/tnameserv-java-1.6.0-openjdk.1.gz
slave unpack200.1.gz: /usr/share/man/man1/unpack200-java-1.6.0-openjdk.1.gz
/usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java - priority 170079
slave keytool: /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/keytool
slave orbd: /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/orbd
slave pack200: /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/pack200
slave rmid: /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/rmid
slave rmiregistry: /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/rmiregistry
slave servertool: /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/servertool
slave tnameserv: /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/tnameserv
slave unpack200: /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/unpack200
slave jre_exports: /usr/lib/jvm-exports/jre-1.7.0-openjdk.x86_64
slave jre: /usr/lib/jvm/jre-1.7.0-openjdk.x86_64
slave java.1.gz: /usr/share/man/man1/java-java-1.7.0-openjdk.1.gz
slave keytool.1.gz: /usr/share/man/man1/keytool-java-1.7.0-openjdk.1.gz
slave orbd.1.gz: /usr/share/man/man1/orbd-java-1.7.0-openjdk.1.gz
slave pack200.1.gz: /usr/share/man/man1/pack200-java-1.7.0-openjdk.1.gz
slave rmid.1.gz: /usr/share/man/man1/rmid-java-1.7.0-openjdk.1.gz
slave rmiregistry.1.gz: /usr/share/man/man1/rmiregistry-java-1.7.0-openjdk.1.gz
slave servertool.1.gz: /usr/share/man/man1/servertool-java-1.7.0-openjdk.1.gz
slave tnameserv.1.gz: /usr/share/man/man1/tnameserv-java-1.7.0-openjdk.1.gz
slave unpack200.1.gz: /usr/share/man/man1/unpack200-java-1.7.0-openjdk.1.gz
Current `best' version is /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java.

提前致谢!!!

0 个答案:

没有答案