nsbin/ssa/sub.add.qmail-v0.3-not-ready

51 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.