Files
darkfi/contrib/init/taud.initd
2022-12-28 13:06:00 +01:00

38 lines
854 B
Plaintext

#!/sbin/openrc-run
# Copyright 1999-2023 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 taud"
env TERM="xterm" \
start-stop-daemon \
--start \
--make-pidfile \
--pidfile /var/run/taud.pid \
--background \
--user $USER \
--env HOME="${PWHOME:-/home/$USER}" \
--name taud \
--exec /usr/bin/screen -- \
-L -Logfile /home/taud/screenlog.0 \
-d -m -S taud /usr/local/bin/taud
eend $?
}
stop() {
ebegin "Stopping taud"
# 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/taud.pid) > /var/run/taud.pid
start-stop-daemon --stop --signal 15 \
--pidfile /var/run/taud.pid
eend $?
}