From 1730798a82c07ef8e90939e77f3e91a299e4d55f Mon Sep 17 00:00:00 2001 From: KronoZed Date: Fri, 27 Jan 2017 19:07:29 +0300 Subject: [PATCH] Create caddy.initd --- www-servers/caddy-bin/files/caddy.initd | 30 +++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 www-servers/caddy-bin/files/caddy.initd diff --git a/www-servers/caddy-bin/files/caddy.initd b/www-servers/caddy-bin/files/caddy.initd new file mode 100644 index 0000000..c328248 --- /dev/null +++ b/www-servers/caddy-bin/files/caddy.initd @@ -0,0 +1,30 @@ +#!/sbin/openrc-run +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +DAEMON=$(which caddy) +USERBIND="setcap cap_net_bind_service=+ep" +STOP_SCHEDULE="${STOP_SCHEDULE:-QUIT/5/TERM/5/KILL/5}" + +depend() { + use net + after dns +} + +start() { + ebegin "Starting Caddy" + $USERBIND $DAEMON + start-stop-daemon --background --start --quiet \ + --make-pidfile --pidfile $PIDFILE \ + --user $NAME --exec $DAEMON \ + -- $CADDY_OPTIONS + eend $? +} + +stop() { + ebegin "Stopping Caddy" + start-stop-daemon --stop --quiet --exec $DAEMON \ + --retry=$STOP_SCHEDULE --pidfile $PIDFILE --name $NAME + eend $? +}