#!/bin/sh
set -e
export port=433
/etc/init.d/pygopherd "$@"
case "$1" in
start)
start-stop-daemon \
--start \
-b \
--quiet \
--pidfile /var/run/stunnel-${port}.pid \
-m \
--exec /usr/bin/stunnel \
-- \
-p /usr/local/etc/ssl/mail.ygrex.ru.crt \
-d 93.92.204.189:${port} \
-f \
-l /bin/nc -- 127.0.0.1 ${port}
;;
*)
start-stop-daemon \
--oknodo \
--stop \
--quiet \
--pidfile /var/run/stunnel-${port}.pid
;;
esac