From: John Knappers (no email)
Date: Wed Oct 04 2006 - 18:26:28 EDT
>John Knappers wrote:
>
>
>>>
>>># Just add these lines to your script
>>>#
>>>domains=("@example1.com" "@example2.com" "@example3.com")
>>>#
>>>cat in_complete_relay_recipient_maps | while read line;
>
>grep "example.com" cat in_complete_relay_recipient_maps | while read line;
>
>>>do
>>>{
>>> user_name=`echo $line|cut -f1 -d"@"`
>>> for i in `echo ${domains[*]}`; do
>>> echo -e "$user_name$i" >> /etc/postfix/relay_recipients
>>> done
>>>}
>>>done
>
>Do another grep run for the other domain and adapt the domains list. There
>are many ways to do this, but this is probably the easiest for you to
>understand.
>
>>>
>>Tonight I'm gonna try this.
I'm trying to create a nice script out of you suggetions, ans it start to
work ! :)
I changed: grep "example.com" cat in_complete_relay_recipient_maps | while
read line;
in cat relay_recipients_imcomplete_smal |grep "domain1.com" | while read
line;
and
# echo -e "$user_name$i" >>
/home/john/testing/relay_recipients_smal in
printf "$user_name$i\tOK\n" >>
/home/john/testing/relay_recipients_smal
(was missing the tab and OK)
But there is one thing left I can't get fixed.
domains=("@example1.com" "@example2.com" "@example3.com")
It would be nice it read this list out of the generic file(s). But I failed
to do so.
At the comand line I was able to at get the following output:
"@example1.com" "@example2.com" "@example3.com"
with the syntax:
awk '!length < 1 && !/#/ && /@/h {printf ("\"%s\" ",$1)}' generic_smal
But is still misses the ( ) surrounding the domain list and adding the line:
domains=awk '!length < 1 && !/#/ && /@/h {printf ("\"%s\" ",$1)}'
generic_smal
causes the script to fail
Sandy, do you know how to do this right?
Thanx for you efford.
John
_________________________________________________________________
Ontmoet nieuwe vrienden via je eigen vrienden! http://spaces.live.com
|
|
|