aports/community/postsrsd/postsrsd.initd
2016-12-20 14:30:43 +01:00

36 lines
973 B
Plaintext

#!/sbin/openrc-run
description="Postfix SRS Daemon"
pidfile="/run/postsrsd.pid"
command="/usr/sbin/postsrsd"
command_args="-D
-d \"${SRS_DOMAIN}\"
-s ${SRS_SECRET-/etc/postsrsd/postsrsd.secret}
-f ${SRS_FORWARD_PORT-10001}
-r ${SRS_REVERSE_PORT-10002}
-p \"${pidfile}\"
-u \"${RUN_AS-postsrsd}\"
-c \"${CHROOT-/usr/lib/postsrsd}\"
-a \"${SRS_SEPARATOR-=}\""
stopsig="SIGTERM"
start_pre() {
if [ -z "${SRS_DOMAIN}" ]
then
eerror "SRS_DOMAIN is not set"
return 1
fi
if [ ! -s /etc/postsrsd/postsrsd.secret ]
then
ebegin "Generating secret"
dd if=/dev/urandom bs=18 count=1 status=none \
| base64 >${SRS_SECRET}
chmod 0600 ${SRS_SECRET}
chown postsrsd ${SRS_SECRET}
eend $?
fi
}