summaryrefslogtreecommitdiff
path: root/network/etcd/rc.etcd
blob: abd95ede0205faa4a4fbff07eb0b243abe2b4fec (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
#!/bin/sh

ETCD_USER=etcd
ETCD_BIN=/usr/bin/etcd
ETCD_LOG_FILE=/var/log/etcd/etcd.log
ETCD_CONFIG_FILE=/etc/etcd/etcd.conf.yml

etcd_start() {
  echo "Starting the etcd service:  $ETCD_BIN"
  su - $ETCD_USER -c "$ETCD_BIN --config-file $ETCD_CONFIG_FILE >> $ETCD_LOG_FILE 2>&1 &"
}

etcd_stop() {
  echo "Stoping the etcd service:  $ETCD_BIN"
  killall etcd
}

etcd_restart() {
  etcd_stop
  sleep 1
  etcd_start
}

case "$1" in
  'start')
    etcd_start
  ;;
  'stop')
    etcd_stop
  ;;
  'restart')
    etcd_restart
  ;;
  *)
    echo "Usage: $0 start|stop|restart"
  ;;
esac