Fix mail test
- Create an empty mailbox file in `/var/mail` so that `inotifywait` can wait on the right file and not just observe the directory.
This commit is contained in:
+7
-1
@@ -12,8 +12,14 @@ delete_unix_user() { # name
|
|||||||
|
|
||||||
# send a mail and wait for delivery
|
# send a mail and wait for delivery
|
||||||
send_test_mail() { # email_address
|
send_test_mail() { # email_address
|
||||||
|
USER=$(echo $1 | cut -f 1 -d '@')
|
||||||
|
# create an empty mailbox file
|
||||||
|
touch /var/mail/$USER
|
||||||
|
chown $USER:mail /var/mail/$USER
|
||||||
|
chmod 600 /var/mail/$USER
|
||||||
|
|
||||||
echo "test mail" | sendmail $1
|
echo "test mail" | sendmail $1
|
||||||
inotifywait -qq -t 3 -e close_write /var/mail
|
inotifywait -qq -t 3 -e close_write /var/mail/$USER
|
||||||
}
|
}
|
||||||
|
|
||||||
# test header
|
# test header
|
||||||
|
|||||||
Reference in New Issue
Block a user