aboutsummaryrefslogtreecommitdiffstats
path: root/testing/etcd/etcd.initd
blob: 2383c88c9b9bf22b04ac1304e2194f002ec1fe16 (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
#!/sbin/openrc-run
# Copyright 2016 Alpine Linux
# Distributed under the terms of the GNU General Public License v2
# $Id$

depend() {
	need net
}

start_pre() {
	checkpath -d -m 0775 -o $USER:$USER $PIDPATH
	checkpath -d -m 0775 -o $USER:$USER $LOGPATH
	checkpath -d -m 0775 -o $USER:$USER $ETCD_DATA_DIR
}

start() {
	ebegin "Starting $SVCNAME"
	start-stop-daemon --start \
		--pidfile "$PIDFILE" \
		--user $USER \
		--chdir "$ETCD_DATA_DIR" \
		--background \
		--make-pidfile \
		--exec /usr/bin/etcd -- \
			--name=$ETCD_NAME \
			--data-dir="$ETCD_DATA_DIR" \
			$ETCD_OPTS
	eend $? "Failed to start $SVCNAME"
}

stop() {
	ebegin "Stopping $SVCNAME"
	start-stop-daemon --stop --pidfile $PIDFILE
	eend $? "Failed to stop $SVCNAME"
	rm -f "$PIDFILE"
}