blob: a1888603440d9876db18d68e0b074dd1485b2e01 (
plain) (
blame)
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
|
#!/bin/bash
. /etc/sysconfig/consul-template
PROGRAM=/usr/bin/consul-template
PIDFILE=/var/run/consul-template/consul-template.pid
ARGS="-config=/etc/consul-template.d -pid-file=$PIDFILE $CONSUL_TEMPLATE_ARGS"
RUNLEVEL=3
NEEDS="+network"
start() {
echo "Starting $NAME..."
TIMEOUT=3
PIDFILE_DIR=$(dirname $PIDFILE)
[ -d $PIDFILE_DIR ] || mkdir $PIDFILE_DIR && chown consul-template:consul-template $PIDFILE_DIR
su consul-template -s /bin/sh -c "$PROGRAM $ARGS &> /dev/null" &
ppid=$!
sleep $TIMEOUT && pgrep -P $ppid > /dev/null || wait $ppid
evaluate_retval
}
stop() {
echo "Stopping $NAME..."
kill -INT $(cat ${PIDFILE} 2> /dev/null) &> /dev/null
evaluate_retval
}
. /etc/init.d/smgl_init
|