init.d não funciona para iniciar a colmeia

2

Eu tento iniciar o servidor hive com um script init.d. Se eu usar o script com:

/etc/init.d/hiveserver2 start

tudo funciona bem.

Mas quando eu uso com:

service hiveserver2 start

será interrompido imediatamente.

Status após o início:

# 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.

O script init.d que eu uso:

#!/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
    
por Frank Olschewski 28.01.2016 / 16:03

0 respostas

Tags