Add foward import
This commit is contained in:
parent
42d9882061
commit
d8abda70cf
4
find-forwards.sh
Normal file
4
find-forwards.sh
Normal file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
find /var/vmail/mailboxes/ \( -iname ".qmail-*" ! -iname ".qmail-default" \) -type f -exec /root/import-forward.sh {} \;
|
||||
|
15
import-forward.sh
Normal file
15
import-forward.sh
Normal file
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
|
||||
#echo $1
|
||||
SOURCE=$(/usr/bin/basename $1 | sed "s/\.qmail-//" | sed "s/\:/\./")
|
||||
PATH=$(dirname $1)
|
||||
#echo "path: $PATH"
|
||||
DOMAIN=$(/usr/bin/basename $PATH)
|
||||
while IFS= read -r LINE
|
||||
do
|
||||
if [[ $LINE == \&* ]]; then
|
||||
TARGET=$(echo $LINE | /usr/bin/tr -d "&")
|
||||
echo "$SOURCE@$DOMAIN -> $TARGET"
|
||||
fi
|
||||
done < $1
|
||||
|
Loading…
Reference in a new issue