diff options
author | André Geraldo Vieira <andre.geraldo@gmail.com> | 2023-07-16 09:57:08 +0700 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2023-07-16 09:57:08 +0700 |
commit | b575e234366e1aaea2cc1d4039097728c93ba506 (patch) | |
tree | 07da5838ca23e00bf0411d12cb3bd86b6f74d5cb /system/graylog-sidecar/rc.graylog-sidecar | |
parent | cc0c902d50cd0f87b40bdd29650c02cf60b82074 (diff) |
system/graylog-sidecar: Added (configuration management system).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/graylog-sidecar/rc.graylog-sidecar')
-rw-r--r-- | system/graylog-sidecar/rc.graylog-sidecar | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/system/graylog-sidecar/rc.graylog-sidecar b/system/graylog-sidecar/rc.graylog-sidecar new file mode 100644 index 0000000000000..956e22f73c88a --- /dev/null +++ b/system/graylog-sidecar/rc.graylog-sidecar @@ -0,0 +1,50 @@ +#!/bin/bash + +PIDOF_CMD=/sbin/pidof +ECHO_CMD=/usr/bin/echo +SLEEP_CMD=/usr/bin/sleep +KILL_CMD=/bin/kill + +NAME=graylog-sidecar +GRAYLOG_CMD=${GRAYLOG_CMD-/usr/bin/${NAME}} + +graylog_sidecar_start() { + if [ -n "$($PIDOF_CMD graylog-sidecar)" ]; then + $ECHO_CMD "Graylog Sidecar seems to be already running." + return + fi + + $ECHO_CMD "Starting Graylog Sidecar." + $GRAYLOG_CMD & +} + +graylog_sidecar_stop() { + if [ -z "$($PIDOF_CMD graylog-sidecar)" ]; then + $ECHO_CMD "Graylog Sidecar does not seem to be running." + return + fi + + $ECHO_CMD "Stopping Graylog Sidecar." + $KILL_CMD $($PIDOF_CMD graylog-sidecar) +} + +graylog_sidecar_restart() { + $ECHO_CMD "Restarting Graylog Sidecar." + graylog_sidecar_stop + $SLEEP_CMD 5 + graylog_sidecar_start +} + +case "$1" in +'start') + graylog_sidecar_start + ;; +'stop') + graylog_sidecar_stop + ;; +'restart') + graylog_sidecar_restart + ;; +*) + echo "usage: $0 start|stop|restart" +esac |