Просмотр исходного кода

contrib/init: faucetd confd and initd files added

aggstam 3 лет назад
Родитель
Сommit
b45148ccd4
2 измененных файлов с 36 добавлено и 0 удалено
  1. 1 0
      contrib/init/faucetd.confd
  2. 35 0
      contrib/init/faucetd.initd

+ 1 - 0
contrib/init/faucetd.confd

@@ -0,0 +1 @@
+USER="faucetd"

+ 35 - 0
contrib/init/faucetd.initd

@@ -0,0 +1,35 @@
+#!/sbin/openrc-run
+# Copyright 1999-2022 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+	use net
+}
+
+start() {
+	PWHOME="$(getent passwd $USER | awk -F: '{ print $6 }')"
+
+	ebegin "Starting faucetd"
+	env TERM="xterm" \
+		start-stop-daemon \
+			--start \
+			--make-pidfile \
+			--pidfile /var/run/faucetd.pid \
+			--background \
+			--user $USER \
+			--env HOME="${PWHOME:-/home/$USER}" \
+			--name faucetd \
+			--exec /usr/bin/screen -- -D -m -S faucetd /usr/local/bin/faucetd
+	eend $?
+}
+
+stop() {
+	ebegin "Stopping faucetd"
+	# Because we've daemonized with screen, we need to replace the PID file
+	# with the real PID of the program
+	pgrep -P $(cat /var/run/faucetd.pid) > /var/run/faucetd.pid
+
+	start-stop-daemon --stop --signal 15 \
+		--pidfile /var/run/faucetd.pid
+	eend $?
+}