#!/sbin/openrc-run
name="git-send-email.io"
description="git-send-email.io webhook service"
# Override these with /etc/conf.d/git-send-emaio.io
GITSENDEMAIL_USER=${GITSENDEMAIL_USER:-gitsendemail}
GITSENDEMAIL_BIND=${GITSENDEMAIL_BIND:-127.0.0.1:5001}
GITSENDEMAIL_ARGS=${GITSENDEMAIL_ARGS:-}
LOGS=/var/log/git-send-emaio.io.log
depend() {
need net
}
start() {
ebegin "Starting $name"
touch "$LOGS"
chown ${GITSENDEMAIL_USER} "$LOGS"
start-stop-daemon \
-u ${GITSENDEMAIL_USER} \
-1 "$LOGS" \
-2 "$LOGS" \
--background \
--make-pidfile \
--pidfile /run/$name.pid \
--exec /usr/bin/gunicorn -- \
email_tutorial.app:app -b ${GITSENDEMAIL_BIND} ${GITSENDEMAIL_ARGS}
eend $?
}
stop() {
ebegin "Stopping $name"
start-stop-daemon --stop --exec /usr/bin/gunicorn --pidfile /run/$name.pid
eend $?
}