blob: 956e22f73c88ae14c176be309e079ae4f118446e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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
|