summaryrefslogtreecommitdiff
path: root/net-p2p/monero/files/monerod.initd
blob: d768c16309c18361f80fd96e556a58ae419c8df7 (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
36
37
38
#!/sbin/openrc-run
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

: ${MONERO_CONFIG:=/etc/monerod.conf}
: ${MONERO_USER:=monero}
: ${MONERO_GROUP:=monero}

PIDFILE="/run/${SVCNAME}.pid"

depend() {
	need net
}

start() {
	checkpath --quiet \
		--file \
		--owner "${MONERO_USER}:${MONERO_GROUP}" \
		"${PIDFILE}" \
		|| return 1

	ebegin "Starting ${RC_SVCNAME}"
	start-stop-daemon --start --quiet \
		--user "${MONERO_USER}:${MONERO_GROUP}" \
		--exec "/usr/bin/${RC_SVCNAME}" \
		-- \
		--detach --non-interactive \
		--pidfile "${PIDFILE}" \
		--config "${MONERO_CONFIG}"
	eend $?
}

stop () {
	ebegin "Stopping ${RC_SVCNAME}"
	start-stop-daemon --stop \
		--pidfile "${PIDFILE}"
	eend $?
}