nsbin/ssa/sub.add.qmail-v0.3-not-ready
Nico Schottelius df2daf524d init
Signed-off-by: Nico Schottelius <nico@manager.schottelius.org>
2017-07-19 17:15:41 +02:00

50 lines
961 B
Bash

#!/bin/sh
. `dirname $0`/sub.defaults
if [ $# -lt 3 ]; then
echo $0: 'VUSER TLD SLD [SUBDOMAIN] [SUBDOMAIN2]'
exit 1
fi
VUSER=$1; shift
case $# in
3)
TLD="$1"
SLD="$2"
VUSER="$3"
;;
4)
TLD="$1"
SLD="$2"
SUBDOMAIN="$3" # currently unused
VUSER="$4"
;;
*)
;;
esac
echo -n adding qmail entry for $SLD.$TLD,which points to $VUSER
echo "$SLD.$TLD" >> $RCPTHOSTS
echo "$SLD.$TLD:$VUSER-$SLD.$TLD" >> $VDOMAINS
# default handling
echo "&$VUSER@schottelius.org" > /home/user/$VUSER/.qmail-$SLD\:$TLD-default
# moi
echo "&nico@schottelius.org" > /home/user/$VUSER/.qmail-$SLD\:$TLD-postmaster
echo "&nico@schottelius.org" > /home/user/$VUSER/.qmail-$SLD\:$TLD-mailer-daemon
echo "&nico@schottelius.org" > /home/user/$VUSER/.qmail-$SLD\:$TLD-root
# perms
chown $VUSER /home/user/$VUSER/.qmail-$SLD\:$TLD-*
echo -n restarting qmail...
# restart
killall -HUP qmail-send
echo done.