[root@localhost Desktop]# which java
/usr/bin/java
[root@localhost Desktop]# ls -lrt /usr/bin/java
lrwxrwxrwx. 1 root root 22 Oct 20 09:36 /usr/bin/java -> /etc/alternatives/java
[root@localhost Desktop]# ls -lrt /etc/alternatives/java
lrwxrwxrwx. 1 root root 46 Oct 20 09:36 /etc/alternatives/java -> /usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin/java
[root@localhost Desktop]#
得到jdk的安装目录:/usr/lib/jvm/jre-1.8.0-openjdk.x86_64
第三步:查找zookeeper的安装目录
zookeeper的安装目录:/root/zookeeper-3.4.6/bin
zookeeper的安装目录相信大家应该都能找到。
第四步:添加参数
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.