This commit is contained in:
Alan Garcia 2012-08-25 14:45:55 +00:00
parent 785b52882d
commit 5e99c9b587
1 changed files with 14 additions and 4 deletions

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# TODO Traduction. # TODO Traduction.
# Script permettant de générer un jeu de données pour tester différents cas sur les mails. # Script permettant de générer un jeu de données pour tester différents cas sur les mails.
@ -21,6 +21,8 @@ MAILBOX_DELIVERY="dovecot"
# Delivery des listes # Delivery des listes
MAILMAN_DELIVERY="mailman" MAILMAN_DELIVERY="mailman"
ALTERNC_MAIL="/var/alternc/mail"
# Fonction pour ajouter la clause where # Fonction pour ajouter la clause where
append_from_address(){ append_from_address(){
username="$1" username="$1"
@ -48,7 +50,7 @@ insert_recipient(){
insert_mailbox(){ insert_mailbox(){
username="$1" username="$1"
echo "INSERT INTO mailbox (address_id, path, delivery) SELECT address.id AS address_id, '$DOMAIN/$username' AS path, '$MAILBOX_DELIVERY' AS delivery" echo "INSERT INTO mailbox (address_id, path, delivery) SELECT address.id AS address_id, '$ALTERNC_MAIL/$DOMAIN/$username' AS path, '$MAILBOX_DELIVERY' AS delivery"
append_from_address "$username" append_from_address "$username"
} }
@ -65,10 +67,12 @@ append_recipients(){
username="$1" username="$1"
shift shift
j=""
for i in $*; do for i in $*; do
insert_recipient "$username" "$i" j=$(echo -e "$j\n$i")
done done
insert_recipient "$username" "$j"
} }
# Fonction permettant d'ajouter une adresse avec un alias avec des destinataires supplémentaires # Fonction permettant d'ajouter une adresse avec un alias avec des destinataires supplémentaires
@ -215,3 +219,9 @@ add_mailbox "50" "recipient00@example.com" "alias00@$DOMAIN" "mailbox00@$DOMAIN"
# list50@$DOMAIN : liste de diffusion avec distribution supplémentaire vers recipient00@example.com, alias00@$DOMAIN, mailbox00@$DOMAIN et list00@$DOMAIN (list + alias00 + alias10 + alias11 + alias12) # list50@$DOMAIN : liste de diffusion avec distribution supplémentaire vers recipient00@example.com, alias00@$DOMAIN, mailbox00@$DOMAIN et list00@$DOMAIN (list + alias00 + alias10 + alias11 + alias12)
add_list "50" "recipient00@example.com" "alias00@$DOMAIN" "mailbox00@$DOMAIN" "list00@$DOMAIN" add_list "50" "recipient00@example.com" "alias00@$DOMAIN" "mailbox00@$DOMAIN" "list00@$DOMAIN"
echo "-- To delete everything"
echo "-- delete from mailbox where address_id in (select id from address where domain_id=2000);"
echo "-- delete from recipient where address_id in (select id from address where domain_id=2000);"
echo "-- delete from address where domain_id = 2000;"
echo "-- delete from domaines where id=2000;"