From e576ecef33a1ccb898c707923d1fcef0704bb017 Mon Sep 17 00:00:00 2001 From: bigmike160 Date: Tue, 9 Oct 2007 03:14:51 +0000 Subject: [PATCH] create-user: Add sanity check in case shared spam dir is really FUBAR Also, change sole use of "[ ... ]" to "test". --- create-user | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/create-user b/create-user index d811558..b64f642 100755 --- a/create-user +++ b/create-user @@ -197,12 +197,23 @@ if test -f $HOMEPATH/Maildir/shared-maildirs; then 's!^(SpamAssassin )/home/spamd!\1/var/local/lib/spamd!1' \ $file fi + NOTIFY=no for dir in $HOMEPATH/Maildir/shared-folders/SpamAssassin/*; do - dest=/var/local/lib/spamd/Maildir/.$(basename $dir) - if test "$(readlink $dir/shared)" != "$dest"; then - ln -sf $dest $dir/shared + if ! test -d $dir; then + NOTIFY=yes + else + dest=/var/local/lib/spamd/Maildir/.$(basename $dir) + if test "$(readlink $dir/shared)" != "$dest"; then + ln -sf $dest $dir/shared + fi fi done + if test $NOTIFY = yes; then + # This is probably going overboard, but oh well + echo "$USER needs assistance on their shared spam dir" | \ + mail -s "[create-user] $USER needs assistance" \ + -e -a "From: admins@deleuze.hcoop.net" mwolson_admin + fi else maildirmake --add SpamAssassin=/var/local/lib/spamd/Maildir \ $HOMEPATH/Maildir @@ -220,7 +231,7 @@ if ! vos examine db.$USER >/dev/null 2>/dev/null; then fi # Create postgres user and tablespace placeholder within volume -if ! [ -d $PGDIR ]; then +if ! test -d $PGDIR; then mkdir -p $PGDIR chown postgres:postgres $PGDIR fs sa -dir $PGDIR -acl system:postgres write -- 2.20.1