ayaports/user/peertube/peertube.openrc

34 lines
765 B
Text

#!/sbin/openrc-run
name="$RC_SVCNAME"
cfgfile="/etc/conf.d/$RC_SVCNAME.conf"
pidfile="/run/$RC_SVCNAME.pid"
working_directory="/usr/share/webapps/peertube"
command="/usr/bin/node"
command_args="dist/server.js"
command_user="peertube"
command_group="peertube"
start_stop_daemon_args=""
command_background="yes"
output_log="/var/log/peertube/$RC_SVCNAME.log"
depend() {
need redis
need postgresql
}
start_pre() {
cd "$working_directory"
checkpath --directory --owner $command_user:$command_group --mode 0775 \
/var/log/peertube \
/var/lib/peertube \
/var/tmp/peertube \
/tmp/peertube
export NODE_ENV NODE_CONFIG_DIR
}
stop_pre() {
ebegin "Killing child processes"
kill $(ps -o pid= --ppid $(cat $pidfile)) || true
}