From: bigmike160 Date: Tue, 9 Oct 2007 03:14:51 +0000 (+0000) Subject: create-user: Add sanity check in case shared spam dir is really FUBAR X-Git-Url: https://git.hcoop.net/hcoop/scripts.git/commitdiff_plain/e576ecef33a1ccb898c707923d1fcef0704bb017?hp=64a96d98231627c9a64970f8ef5f6d3c4d6a900c create-user: Add sanity check in case shared spam dir is really FUBAR Also, change sole use of "[ ... ]" to "test". --- 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