#!/sbin/openrc-run
description="YES near-real-time new-video poller (newest pages only; the hourly import stays the full pass)"
supervisor=supervise-daemon
command=/usr/bin/yes-site
command_args="poll-new"
command_user="yes-site:yes-site"
pidfile="/run/${RC_SVCNAME}.pid"
no_new_privs=yes
retry="TERM/30/KILL/5"
respawn_delay=10
respawn_max=0

depend() {
	need net
	use dns
}

start_pre() {
	set -a
	. /etc/yes-site/yes-site.env
	[ -r /etc/yes-site/secrets.env ] && . /etc/yes-site/secrets.env
	set +a
	checkpath -d -m 0750 -o yes-site:yes-site /var/lib/yes-site
	checkpath -d -m 0755 -o yes-site:yes-site /run/yes-poll
}
