How To Export/Import Signature on Zimbra Mail Server
Export (on the old Zimbra)
# Create simple script for retrieve information of signature
cd /srv/
mkdir sig
vi export-signature.sh
Fill with the following line
#!/bin/bash
clear
mkdir -p /tmp/sig
echo "Retrieve zimbra user name..."
USERS=`su - zimbra -c 'zmprov -l gaa | sort'`;
for ACCOUNT in $USERS; do
NAME=`echo $ACCOUNT`;
sign=`su - zimbra -c "zmprov ga $NAME zimbraPrefMailSignature" > /tmp/sig/$NAME`
sed -i -e "1d" /tmp/sig/$NAME
sed 's/zimbraPrefMailSignature: //g' /tmp/sig/$NAME > sig/$NAME
rm /tmp/sig/$NAME
echo "Export signature for $NAME..."
done
echo "All signature has been export successfully"
# Save and execute
chmod +x export-signature.sh
sh export-signature.sh
The all result of above command are files which is saved in /srv/sig folder. Copy sig folder to the new Zimbra
Import (on the new Zimbra)
Assuming sig folder is placed in /srv/ folder. Make the simple script for importing signature who has been exported
cd /srv/
vi import-signature.sh
Fill with the following line
for file in /srv/sig/*
do
StrSign=`cat "$file"`
Acc=`echo $file | cut -d "/" -f5`
su - zimbra -c "zmprov ma $Acc zimbraPrefMailSignature '$StrSign'"
echo "Process import signature $Acc"
done
echo "Process import signature has been finished"
Note : The signature who has been export/import is only text signature (not include html).
# Create simple script for retrieve information of signature
cd /srv/
mkdir sig
vi export-signature.sh
Fill with the following line
#!/bin/bash
clear
mkdir -p /tmp/sig
echo "Retrieve zimbra user name..."
USERS=`su - zimbra -c 'zmprov -l gaa | sort'`;
for ACCOUNT in $USERS; do
NAME=`echo $ACCOUNT`;
sign=`su - zimbra -c "zmprov ga $NAME zimbraPrefMailSignature" > /tmp/sig/$NAME`
sed -i -e "1d" /tmp/sig/$NAME
sed 's/zimbraPrefMailSignature: //g' /tmp/sig/$NAME > sig/$NAME
rm /tmp/sig/$NAME
echo "Export signature for $NAME..."
done
echo "All signature has been export successfully"
# Save and execute
chmod +x export-signature.sh
sh export-signature.sh
The all result of above command are files which is saved in /srv/sig folder. Copy sig folder to the new Zimbra
Import (on the new Zimbra)
Assuming sig folder is placed in /srv/ folder. Make the simple script for importing signature who has been exported
cd /srv/
vi import-signature.sh
Fill with the following line
for file in /srv/sig/*
do
StrSign=`cat "$file"`
Acc=`echo $file | cut -d "/" -f5`
su - zimbra -c "zmprov ma $Acc zimbraPrefMailSignature '$StrSign'"
echo "Process import signature $Acc"
done
echo "Process import signature has been finished"
Note : The signature who has been export/import is only text signature (not include html).
Comments
Post a Comment