2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-01-18 05:33:17 +00:00
Jarrod Johnon 059b448932 Cleanly handle stop/restart when not running
Previously some rather uncomfortable looking output would be emitted at someone trying to restart
confluent if not running.  Be nicer and recognize when service is not running and a stop attempt is made.
2014-11-18 17:02:54 -05:00

46 lines
941 B
Bash
Executable File

#!/bin/sh
# IBM(c) 2014 Apache 2.0
# chkconfig: 345 85 60
# description: Confluent hardware manager
### BEGIN INIT INFO
# Provides: confluent
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
### END INIT INFO
if [ -f /etc/init.d/functions ]; then
. /etc/init.d/functions
LOG_SUCCESS=success
elif [ -f /lib/lsb/init-functions ]; then
. /lib/lsb/init-functions
LOG_SUCCESS=log_success_msg
else
echo "Unknown platform"
exit 1
fi
case $1 in
restart)
if [ -S /var/run/confluent/api.sock ]; then
echo -n 'Stopping Confluent '
/opt/confluent/bin/confetty shutdown /
fi
echo -n 'Starting Confluent '
/opt/confluent/bin/confluent
$LOG_SUCCESS
;;
start)
echo -n 'Starting Confluent '
/opt/confluent/bin/confluent
$LOG_SUCCESS
;;
stop)
echo -n 'Stopping Confluent '
if [ -S /var/run/confluent/api.sock ]; then
/opt/confluent/bin/confetty shutdown /
fi
$LOG_SUCCESS
;;
esac