summaryrefslogtreecommitdiff
path: root/ucs-3.x/18-deliver-to-john-doe-mailalternate.sh
blob: 7c1a3b460f900c3719473f5487bbc55e2ab99530 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash

eval "$(ucr shell)"

retval=$(./*-create-user-john-doe.sh >/dev/null 2>&1; echo $?)

if [ $retval -ne 0 ]; then
    echo "SKIP: prerequisite test $(ls -1 *-create-user-john-doe*) has failed"
    exit 1
fi

md5hash=`date | md5sum | awk '{print $1}'`

echo "${md5hash}" | mail -s "${md5hash}" ceo@${domainname}

mbpath=`/usr/lib/cyrus-imapd/mbpath user/doe@${domainname}`

x=10
y=0

while [ ${y} -lt ${x} ]; do
    result=`grep "Subject: ${md5hash}" ${mbpath}/*. 2>/dev/null`

    if [ -z "${result}" ]; then
        # Not yet found
        sleep 1
    else
        y=${x}
        echo "OK"
    fi
    let y++
done