Difference between revisions of "Exchange receipients.sh"

From Alpine Linux
Jump to: navigation, search
(New page: #!/bin/sh ### The minimal lines virtual.txt must have to generate the db MINLINES="50" ### The url to the receipients file URL="" wget "$URL" -qO /tmp/virtual.txt if [ -f /tmp/virtual.t...)
 
(Category:Mail)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
#!/bin/sh
+
<pre>
 +
#!/bin/sh
  
### The minimal lines virtual.txt must have to generate the db
+
### The minimal lines virtual.txt must have to generate the db
MINLINES="50"
+
MINLINES="50"
### The url to the receipients file
+
### The url to the receipients file
URL=""
+
URL=""
  
wget "$URL" -qO /tmp/virtual.txt
+
wget "$URL" -qO /tmp/virtual.txt
  
if [ -f /tmp/virtual.txt ]; then
+
if [ -f /tmp/virtual.txt ]; then
  LINES=`cat /tmp/virtual.txt | wc -l`
+
    LINES=`cat /tmp/virtual.txt | wc -l`
  if [ "$LINES" -gt "$MINLINES" ]; then
+
    if [ "$LINES" -gt "$MINLINES" ]; then
      dos2unix /tmp/virtual.txt
+
      dos2unix /tmp/virtual.txt
  
      sed '/^\#/d; /^$/d' /tmp/virtual.txt > /etc/postfix/exchange_receipients
+
      sed '/^\#/d; /^$/d' /tmp/virtual.txt &gt; /etc/postfix/exchange_receipients
      postmap /etc/postfix/exchange_receipients
+
      postmap /etc/postfix/exchange_receipients
  fi
+
    fi
fi
+
fi
 +
</pre>
 +
 
 +
[[Category:Mail]]

Latest revision as of 09:29, 12 March 2012

 #!/bin/sh

 ### The minimal lines virtual.txt must have to generate the db
 MINLINES="50"
 ### The url to the receipients file
 URL=""

 wget "$URL" -qO /tmp/virtual.txt

 if [ -f /tmp/virtual.txt ]; then
    LINES=`cat /tmp/virtual.txt | wc -l`
    if [ "$LINES" -gt "$MINLINES" ]; then
       dos2unix /tmp/virtual.txt

       sed '/^\#/d; /^$/d' /tmp/virtual.txt > /etc/postfix/exchange_receipients
       postmap /etc/postfix/exchange_receipients
    fi
 fi