Service setup
sudo true
sudo install -d -m2775 -o root -g staff /var/qmail/control/qmail-send
cd /var/qmail/control/qmail-send || cat >&2
cat > run <<'EOF'
#!/bin/sh
#
# qmail-send and friends
#
QMAIL="/var/qmail"
if [ -e $QMAIL/control/defaultdelivery ]; then
ALIASEMPTY=`cat $QMAIL/control/defaultdelivery 2> /dev/null`
else
ALIASEMPTY=`cat $QMAIL/control/aliasempty 2> /dev/null`
fi
ALIASEMPTY=${ALIASEMPTY:="./Maildir/"}
PATH="$QMAIL/bin:$PATH"
# limit to prevent memory hogs
ulimit -c 204800
exec chpst -e ./env qmail-start "$ALIASEMPTY"
EOF
chmod +x run
mkdir env
sudo install -d -m 2770 -o root -g staff /var/lib/supervise/qmail-send
ln -nfs /var/lib/supervise/qmail-send supervise
mkdir log
cd log || cat >&2
cat > run <<EOF
#!/bin/sh
exec chpst -u qmaill svlogd -t main
EOF
chmod +x run
sudo install -d -m 2770 -o root -g staff /var/lib/supervise/qmail-send.log
ln -nfs /var/lib/supervise/qmail-send.log supervise
# Create log directory
sudo install -d -m 2750 -o qmaill -g qmail /var/log/qmail-send
ln -s /var/log/qmail-send main
Activate the qmail-send service
cd /var/qmail/control/qmail-send
tail -F log/main/current&
ln -s `pwd` /service
# Wait max 5s for the log to appear
# Make service controllable by staff
sudo true
sudo chmod g+rw {.,log}/supervise/{ok,control}