From 6ab1ae0c3843d5c8b73eb053a5ac0a6737b884ff Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Mon, 18 May 2015 14:00:35 -0400 Subject: [PATCH] Implemented functions for start() and stop(). The restart case will call the stop() and start() functions. Impemented the status case so that 'service confluent status' will return the state of confluent daemon. --- confluent_server/sysvinit/confluent | 43 +++++++++++++++++++---------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/confluent_server/sysvinit/confluent b/confluent_server/sysvinit/confluent index 6661a308..94852435 100755 --- a/confluent_server/sysvinit/confluent +++ b/confluent_server/sysvinit/confluent @@ -19,27 +19,40 @@ else exit 1 fi +confluent=/opt/confluent/bin/confluent +confetty=/opt/confluent/bin/confetty + +stop() { + echo -n 'Stopping Confluent: ' + if [ -S /var/run/confluent/api.sock ]; then + $confetty shutdown / + fi + $LOG_SUCCESS + echo + return +} + +start() { + echo -n 'Starting Confluent: ' + $confluent + $LOG_SUCCESS + echo + return +} + 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 + stop + start ;; start) - echo -n 'Starting Confluent ' - /opt/confluent/bin/confluent - $LOG_SUCCESS + start ;; stop) - echo -n 'Stopping Confluent ' - if [ -S /var/run/confluent/api.sock ]; then - /opt/confluent/bin/confetty shutdown / - fi - $LOG_SUCCESS + stop + ;; + status) + status -p /var/run/confluent/pid $confluent ;; esac