summaryrefslogtreecommitdiff
blob: a2c67d0723dac465088afad6221460c3b9d97652 (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
#!/sbin/openrc-run
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

pidfile=/run/${RC_SVCNAME}.pid
LOGPATH=/var/log/${RC_SVCNAME}
DATADIR=/var/lib/${RC_SVCNAME}
command_user=${RC_SVCNAME}
command=/usr/bin/etcd
command_args="
	-name=${ETCD_NAME}
	-data-dir=${ETCD_DATA_DIR}
	${ETCD_OPTS}"
command_background=true
start_stop_daemon_args="
	--chdir ${ETCD_DATA_DIR}
	-1 ${LOGPATH}/${RC_SVCNAME}.log
	-2 ${LOGPATH}/${RC_SVCNAME}.err"

depend() {
	need net
	need localmount
	after bootmisc
}

start() {
	if [ ! -d "${LOGPATH}" ] ; then
		mkdir -p "${LOGPATH}"
		chown "${command_user}:${command_user}" "${LOGPATH}"
	fi
	if [ ! -d "${ETCD_DATA_DIR}" ] ; then
		mkdir -p "${ETCD_DATA_DIR}"
		chown "${command_user}:${command_user}" "${ETCD_DATA_DIR}"
	fi
	default_start
}