containers-postsrsd/postsrsd.sh

19 lines
458 B
Bash
Executable File

#!/bin/sh
set -e
export SRS_PID_FILE=/run/postsrsd/postsrsd.pid
case $1 in
start)
test -n "${SRS_DOMAIN}"
test -n "${SRS_SECRET}"
test -f "${SRS_SECRET}" || dd if=/dev/urandom bs=18 count=1 status=none | base64 > "${SRS_SECRET}"
install -dm 750 -o postsrsd -g postsrsd "${SRS_PID_FILE%/*}"
/usr/sbin/postsrsd -e -D -u postsrsd -l ::
;;
stop)
test ! -f "${SRS_PID_FILE}" || cat "${SRS_PID_FILE}" | xargs -r kill
;;
esac