Obtain all the forwards per each account

Discuss your pilot or production implementation with other Zimbra admins or our engineers.
ingenetic
Posts: 24
Joined: Wed Feb 19, 2020 3:01 pm

Obtain all the forwards per each account

Postby ingenetic » Wed Mar 11, 2020 8:20 am

Hi all,

I want to obtai all the forwards per each account on my zimbra , i'm using this tutorial :

https://wiki.zimbra.com/wiki/Obtain_all_the_forwards_per_each_account


I've try it in my other zimbra machine, it's work correctly. ( Sles 11 , Zimbra 8.6 )

But when i try at other machine (centos 7 , zimbra 8.8.15) at the beginning it doesn't work .

here is the cli :


[root@mail ernest]# vi checkforward.sh

#!/bin/sh

for account in `zmprov -l gaa`; do
forwardingaddress=`zmprov ga $account |grep 'zimbraPrefMailForwardingAddress' |sed 's/zimbraPrefMailForwardingAddress: //'`
if [ "$forwardingaddress" != "" ]; then
echo "$account is forwarded to $forwardingaddress"
else
forwardingaddress=""
fi
done

[root@mail ernest]# vi checkforward.sh
[root@mail ernest]# chown zimbra:zimbra checkforward.sh
[root@mail ernest]# chmod +x checkforward.sh
[root@mail ernest]# su - zimbra
Last login: Wed Mar 11 03:10:47 WIB 2020
[zimbra@mail ~]$ ./checkforward.sh

at the last line when type ./chec + tab , it's not call file checkforward.sh,
as i remember ( cause i'm doing this 2 weeks ago ) so i type manually , and no respon, just back to '[zimbra@mail ~]$"

and now ( it seems running ) still running now ,
but i execute the command like this :

[zimbra@mail ~]$ ../checkforward.sh ( with double dot )
when i type ../chec + tab , it's call the file "checkforward.sh".

now the script still running, dunno the result, is it work or not,
but what making me confuse is why "double dot" ?

did anyone can explain , why it's happened ?


Regards,


User avatar
DualBoot
Elite member
Elite member
Posts: 1228
Joined: Mon Apr 18, 2016 8:18 pm
Location: France - Earth
ZCS/ZD Version: ZCS FLOSS - 8.8.15 Mutli servers
Contact:

Re: Obtain all the forwards per each account

Postby DualBoot » Wed Mar 11, 2020 8:34 am

Hello,

not a zimbra problem, it is bash problem.
By the way you can check if you're in the right folder or anything else by using ls -lha command.

Regards,
ingenetic
Posts: 24
Joined: Wed Feb 19, 2020 3:01 pm

Re: Obtain all the forwards per each account

Postby ingenetic » Wed Mar 11, 2020 8:55 am

DualBoot wrote:Hello,

not a zimbra problem, it is bash problem.
By the way you can check if you're in the right folder or anything else by using ls -lha command.

Regards,


Hi DualBoot,

the result is ; show nothing :
Last login: Wed Mar 11 03:10:47 WIB 2020
[zimbra@mail ~]$ ../checkforward.sh
[zimbra@mail ~]$

then here is result of ls -lha :

drwx------ 5 ernest ernest 151 Mar 11 14:51 .
drwxr-xr-x. 5 root root 52 Feb 20 13:57 ..
-rw------- 1 ernest ernest 140 Mar 11 11:47 .bash_history
-rw-r--r-- 1 ernest ernest 18 Aug 8 2019 .bash_logout
-rw-r--r-- 1 ernest ernest 193 Aug 8 2019 .bash_profile
-rw-r--r-- 1 ernest ernest 231 Aug 8 2019 .bashrc
drwxrwxr-x 3 ernest ernest 18 Feb 20 14:00 .cache
-rwxr-xr-x 1 zimbra zimbra 303 Mar 6 09:31 checkforward.sh
drwxrwxr-x 3 ernest ernest 18 Feb 20 14:00 .config
drwxr-xr-x 4 ernest ernest 39 Feb 16 00:20 .mozilla

please advice, how to Obtain all the forwards per each account in zimbra 8.8.15,
or please show me if any incorrect in my script "checkfoward.sh".

Thank you and regards,
User avatar
DualBoot
Elite member
Elite member
Posts: 1228
Joined: Mon Apr 18, 2016 8:18 pm
Location: France - Earth
ZCS/ZD Version: ZCS FLOSS - 8.8.15 Mutli servers
Contact:

Re: Obtain all the forwards per each account

Postby DualBoot » Wed Mar 11, 2020 9:03 am

Quick answer :
zmprov -l gaa | while read ACCOUNT ; do zmprov ga ${ACCOUNT} zimbraMailForwardingAddress

Regards,
ingenetic
Posts: 24
Joined: Wed Feb 19, 2020 3:01 pm

Re: Obtain all the forwards per each account

Postby ingenetic » Wed Mar 11, 2020 9:34 am

DualBoot wrote:Quick answer :
zmprov -l gaa | while read ACCOUNT ; do zmprov ga ${ACCOUNT} zimbraMailForwardingAddress

Regards,


usually if i add autoforward email , i add the forward to address from admin console in :

Forwarding addresses hidden from the user:


i try to excecute that command in cli , showing nothing like this :


[zimbra@mail ~]$ zmprov -l gaa | while read ACCOUNT ; do zmprov ga ${ACCOUNT} zimbraMailForwardingAddress
>

just blank, please advice .


Regards,
User avatar
DualBoot
Elite member
Elite member
Posts: 1228
Joined: Mon Apr 18, 2016 8:18 pm
Location: France - Earth
ZCS/ZD Version: ZCS FLOSS - 8.8.15 Mutli servers
Contact:

Re: Obtain all the forwards per each account

Postby DualBoot » Wed Mar 11, 2020 10:37 am

Sorry missing end :
zmprov -l gaa | while read ACCOUNT ; do zmprov ga ${ACCOUNT} zimbraMailForwardingAddress ; done
ingenetic
Posts: 24
Joined: Wed Feb 19, 2020 3:01 pm

Re: Obtain all the forwards per each account

Postby ingenetic » Thu Mar 12, 2020 4:27 am

DualBoot wrote:Sorry missing end :
zmprov -l gaa | while read ACCOUNT ; do zmprov ga ${ACCOUNT} zimbraMailForwardingAddress ; done


Thanks a lot again .. DualBoot


Regards,

Return to “Administrators”

Who is online

Users browsing this forum: No registered users and 17 guests