| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- #!@l_prefix@/lib/openpkg/bash @l_prefix@/etc/rc
- ##
- ## rc.stunnel -- Run-Commands
- ##
- %config
- stunnel_enable="$openpkg_rc_def"
- stunnel_daemon="no"
- stunnel_flags=""
- stunnel_log_prolog="true"
- stunnel_log_epilog="true"
- stunnel_log_numfiles="10"
- stunnel_log_minsize="1M"
- stunnel_log_complevel="9"
- %common
- stunnel_logfile="@l_prefix@/var/stunnel/stunnel.log"
- stunnel_pidfile="@l_prefix@/var/stunnel/stunnel.pid"
- stunnel_signal () {
- [ -f $stunnel_pidfile ] && kill -$1 `cat $stunnel_pidfile`
- }
- %status -u @l_susr@ -o
- stunnel_usable="unknown"
- stunnel_active="no"
- rcService stunnel enable yes && \
- stunnel_signal 0 && stunnel_active="yes"
- echo "stunnel_enable=\"$stunnel_enable\""
- echo "stunnel_usable=\"$stunnel_usable\""
- echo "stunnel_active=\"$stunnel_active\""
- %start -u @l_susr@
- rcService stunnel enable yes || exit 0
- rcService stunnel active yes && exit 0
- rcVarIsYes stunnel_daemon || exit 0
- @l_prefix@/sbin/stunnel $stunnel_flags
- %stop -u @l_susr@
- rcService stunnel enable yes || exit 0
- rcService stunnel active no && exit 0
- rcVarIsYes stunnel_daemon || exit 0
- stunnel_signal TERM
- sleep 2
- rm -f $stunnel_pidfile >/dev/null 2>&1 || true
- %restart -u @l_susr@
- rcService stunnel enable yes || exit 0
- rcService stunnel active no && exit 0
- rcVarIsYes stunnel_daemon || exit 0
- rc stunnel stop start
- %daily -u @l_susr@
- rcService stunnel enable yes || exit 0
- shtool rotate -f \
- -n ${stunnel_log_numfiles} -s ${stunnel_log_minsize} -d \
- -z ${stunnel_log_complevel} -o @l_rusr@ -g @l_rgrp@ -m 644 \
- -P "${stunnel_log_prolog}" \
- -E "${stunnel_log_epilog}" \
- @l_prefix@/var/stunnel/stunnel.log
|