init.d脚本无法启动configuration单元

我尝试使用init.d脚本启动configuration单元服务器。 如果我使用脚本:

/etc/init.d/hiveserver2 start 

一切正常。

但是当我使用它时:

 service hiveserver2 start 

它会立即停止。

开始后的状态:

 # systemctl status hiveserver2 ● hiveserver2.service - LSB: Hive Server 2 Loaded: loaded (/etc/init.d/hiveserver2) Active: active (exited) since Thu 2016-01-28 15:21:33 CET; 13s ago Process: 3997 ExecStop=/etc/init.d/hiveserver2 stop (code=exited, status=0/SUCCESS) Process: 4001 ExecStart=/etc/init.d/hiveserver2 start (code=exited, status=0/SUCCESS) Jan 28 15:21:33 localhost hiveserver2[4001]: Start hiveserver2 Jan 28 15:21:33 localhost systemd[1]: Started LSB: Hive Server 2. 

我使用的init.d脚本:

 #!/bin/sh ### BEGIN INIT INFO # Provides: hiveserver2 # Required-Start: $network $local_fs # Required-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Hive Server 2 # Description: Hive Server 2 #### END INIT INFO NAME=hiveserver2 CMD="/root/apache-hive-1.2.1-bin/bin/hiveserver2" ########## Common SSD=start-stop-daemon PID=/var/run/${NAME}.pid start () { echo -n "Start $NAME" $SSD --start --pidfile $PID --make-pidfile --retry 15 --background --exec $CMD RETVAL=$? echo return $RETVAL } stop () { echo -n "Stop $NAME" $SSD --stop --oknodo --retry 15 --pidfile $PID RETVAL=$? echo return $RETVAL } restart () { stop sleep 1 start } case "$1" in start) start ;; stop) stop ;; status) echo "not supported" ;; restart) restart ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 esac