Difference between revisions of "Setting automatic Default Signature"

 
Line 1: Line 1:
 
 
Use this script for set automatic Default Signatures for all users reading it's LDAP information.
 
Use this script for set automatic Default Signatures for all users reading it's LDAP information.
  
Line 7: Line 6:
  
 
   #!/bin/bash
 
   #!/bin/bash
 
+
 
 
   RUTA="/opt/zimbra/bin"
 
   RUTA="/opt/zimbra/bin"
 
+
 
 
   # Check for run as zimbra user
 
   # Check for run as zimbra user
 
   ID=`id -u -n`
 
   ID=`id -u -n`
Line 17: Line 16:
 
       exit 1
 
       exit 1
 
   fi
 
   fi
 
+
 
 
+
 
 
   # Obtain all accounts
 
   # Obtain all accounts
 
   accounts=`$RUTA/zmprov gaa`
 
   accounts=`$RUTA/zmprov gaa`
 
+
 
 
   for ac in $accounts; do
 
   for ac in $accounts; do
 
       echo -ne "Checking account: $ac \t"
 
       echo -ne "Checking account: $ac \t"
 
+
 
 
       # Verify for set signature
 
       # Verify for set signature
 
       sign=`$RUTA/zmprov -l ga $ac | grep zimbraPrefMailSignatureEnabled | cut -d : -f 2`
 
       sign=`$RUTA/zmprov -l ga $ac | grep zimbraPrefMailSignatureEnabled | cut -d : -f 2`
 
+
 
 
       if [ `echo $sign | grep TRUE` ]; then
 
       if [ `echo $sign | grep TRUE` ]; then
 
         echo "This account have a Signature!!!"
 
         echo "This account have a Signature!!!"
 
       else
 
       else
 
         echo -ne "Setting signature... "
 
         echo -ne "Setting signature... "
 
+
 
 
         # Obtain signature from LDAP user atributes
 
         # Obtain signature from LDAP user atributes
 
         signature=`$RUTA/zmprov ga $ac | egrep "(^cn|^ou|^company|^street|^telephoneNumber)" | cut -d : -f 2 | sed 's/^\ //g'`
 
         signature=`$RUTA/zmprov ga $ac | egrep "(^cn|^ou|^company|^street|^telephoneNumber)" | cut -d : -f 2 | sed 's/^\ //g'`
 
+
 
 
         # Set signature for account $ca
 
         # Set signature for account $ca
 
         $RUTA/zmprov ma $ac zimbraPrefMailSignatureEnabled TRUE  zimbraPrefMailSignatureStyle internet zimbraPrefMailSignature "$signature"
 
         $RUTA/zmprov ma $ac zimbraPrefMailSignatureEnabled TRUE  zimbraPrefMailSignatureStyle internet zimbraPrefMailSignature "$signature"
 
+
 
 
         echo "done!"
 
         echo "done!"
 
       fi
 
       fi
 
+
 
 
   done
 
   done

Revision as of 17:49, 2 October 2006

Use this script for set automatic Default Signatures for all users reading it's LDAP information.

I asume that user have any information in his LDAP attributes.

The script set_signature.sh:

  #!/bin/bash
  
  RUTA="/opt/zimbra/bin"
  
  # Check for run as zimbra user
  ID=`id -u -n`
  if [ x$ID != "xzimbra" ]; then
     echo "Please run as ZIMBRA user"
     echo "Exiting..."
     exit 1
  fi
  
  
  # Obtain all accounts
  accounts=`$RUTA/zmprov gaa`
  
  for ac in $accounts; do
     echo -ne "Checking account: $ac \t"
  
     # Verify for set signature
     sign=`$RUTA/zmprov -l ga $ac | grep zimbraPrefMailSignatureEnabled | cut -d : -f 2`
  
     if [ `echo $sign | grep TRUE` ]; then
        echo "This account have a Signature!!!"
     else
        echo -ne "Setting signature... "
  
        # Obtain signature from LDAP user atributes
        signature=`$RUTA/zmprov ga $ac | egrep "(^cn|^ou|^company|^street|^telephoneNumber)" | cut -d : -f 2 | sed 's/^\ //g'`
  
        # Set signature for account $ca
        $RUTA/zmprov ma $ac zimbraPrefMailSignatureEnabled TRUE  zimbraPrefMailSignatureStyle internet zimbraPrefMailSignature "$signature"
  
        echo "done!"
     fi
  
  done
Jump to: navigation, search