diff options
author | Anthony G. Basile <blueness@gentoo.org> | 2016-07-06 07:20:44 -0400 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2016-07-06 07:20:44 -0400 |
commit | 75e8a84bc6a37d5dc5752e3eac0ca667566d165a (patch) | |
tree | 4251064f2fa5450df4f11ee2103c67b45fab96ec /net-misc/stunnel/files | |
parent | profiles: drop kde-plasma/plasma-workspace[calendar] mask on arm (diff) | |
download | gentoo-75e8a84bc6a37d5dc5752e3eac0ca667566d165a.tar.gz gentoo-75e8a84bc6a37d5dc5752e3eac0ca667566d165a.tar.bz2 gentoo-75e8a84bc6a37d5dc5752e3eac0ca667566d165a.zip |
net-misc/stunnel: reload configuration using HUP, bug #588054
Package-Manager: portage-2.2.28
Diffstat (limited to 'net-misc/stunnel/files')
-rw-r--r-- | net-misc/stunnel/files/stunnel-r1 | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/net-misc/stunnel/files/stunnel-r1 b/net-misc/stunnel/files/stunnel-r1 new file mode 100644 index 000000000000..e7eee32c2f15 --- /dev/null +++ b/net-misc/stunnel/files/stunnel-r1 @@ -0,0 +1,51 @@ +#!/sbin/openrc-run +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +extra_started_commands="reload" +SERVICENAME=${SVCNAME#*.} +SERVICENAME=${SERVICENAME:-stunnel} +STUNNEL_CONFIGFILE=${STUNNEL_CONFIGFILE:-/etc/stunnel/${SERVICENAME}.conf} + +depend() { + need net + before logger +} + +get_config() { + if [ ! -e ${STUNNEL_CONFIGFILE} ] ; then + eerror "You need to create ${STUNNEL_CONFIGFILE} first." + return 1 + fi + CHROOT=$(grep "^chroot" ${STUNNEL_CONFIGFILE} | sed "s;.*= *;;") + [ -n "${CHROOT}" ] && CHROOT="--chroot ${CHROOT}" + PIDFILE=$(grep "^pid" ${STUNNEL_CONFIGFILE} | sed "s;.*= *;;") + PIDFILE=${PIDFILE:-/run/stunnel/${SERVICENAME}.pid} +} + +start() { + get_config || return 1 + checkpath -d -m 0775 -o root:stunnel /run/stunnel + if [ "$(dirname ${PIDFILE})" != "/run" ]; then + checkpath -d -m 0755 -o stunnel:stunnel -q $(dirname ${PIDFILE}) + fi + ebegin "Starting ${SVCNAME}" + start-stop-daemon --start --pidfile "${PIDFILE}" ${CHROOT} \ + --exec /usr/bin/stunnel -- ${STUNNEL_CONFIGFILE} ${STUNNEL_OPTIONS} + eend $? "Failed to start ${SVCNAME}" +} + +stop() { + get_config || return 1 + ebegin "Stopping ${SVCNAME}" + start-stop-daemon --stop --quiet --pidfile ${PIDFILE} + eend $? "Failed to stop ${SVCNAME}" +} + +reload() { + get_config || return 1 + ebegin "Reloading ${SVCNAME}" + start-stop-daemon --signal HUP --pidfile ${PIDFILE} --name stunnel + eend $? +} |