Open kamzata opened 10 years ago
Hi Kamzata.
Thanks for reporting the issue.
First, can you give some information on your zimbra setup (run 'zmcontrol -v' as the zimbra user) ?
Do you run the script directly from the zimbra server ?
Does "zmprov -l gaa" command launched as the zimbra user gives you anything ?
I don't understand why you need to change all by ' in the entire script,
are used by bash to perform command substitution, so without `, the script won't work at all because they are used for the getopt part, which is very important.
Don't hesitate to provide as much information as you can. It will be easier for me to spot the problem here.
Thanks.
zimbra@myserver:/$ zmcontrol -v Release 8.0.7.GA.6021.UBUNTU12.64 UBUNTU12_64 FOSS edition.
Yes, I run script directly on zimbra server.
zimbra@myserver:/$ zmprov -l gaa info@domain1.com info@domain2.com .....
Yes, it output list of all email address
About substitution, if I leave ` and I run the script it return me an error like:
"Error in line 165... don't expect EOF" "Error in line 166... don't expect EOF"
Ok.
I see the issue.
It only appears when the script is launched by the zimbra user. When launching as root, there's no issue.
The last commit (1ab5f7c0d5c4ed091fc8978ad25578203339f284) corrects this issue.
Thanks for reporting the issue and sorry for the inconvenience.
Thank you for reply. No, even launching script by root nothing change, it show me same problems.
Ok, strange because the issue was on the part which is only run when the script is directly run using the zimbra user.
Can you confirm it's working now ?
Thanks.
This is the output with the latest version you commit:
root@myserver:/# zimbashckup.sh -v galsync@domain1.com Nothing to backup here... Mail filters (in sieve format) => /opt/zimbra/backup/mailbox/2014/09/03/galsync@domain1.com/filters.sieve info@domain2.com Nothing to backup here... Mail filters (in sieve format) => /opt/zimbra/backup/mailbox/2014/09/03/info@domain2.com/filters.sieve galsync@domain2.com /_zimbra => /opt/zimbra/backup/mailbox/2014/09/03/galsync@domain2.com/_zimbra.tar ERROR: zclient.IO_ERROR (Unable to get REST resource from http://mail.domain2.com/home/galsync@domain2.com/_zimbra?fmt=tar: Connection refused) (cause: java.net.ConnectException Connection refused) ERROR : Unable to backup folder /zimbra, skipping _ Mail filters (in sieve format) => /opt/zimbra/backup/mailbox/2014/09/03/galsync@domain2.com/filters.sieve vendite@domain2.com Nothing to backup here... Mail filters (in sieve format) => /opt/zimbra/backup/mailbox/2014/09/03/vendite@domain2.com/filters.sieve supporto@domain2.com Nothing to backup here... Mail filters (in sieve format) => /opt/zimbra/backup/mailbox/2014/09/03/supporto@domain2.com/filters.sieve admin@domain3.com /Inbox => /opt/zimbra/backup/mailbox/2014/09/03/admin@domain3.com/Inbox.tar Mail filters (in sieve format) => /opt/zimbra/backup/mailbox/2014/09/03/admin@domain3.com/filters.sieve claudio@domain3.com /Emailed Contacts => /opt/zimbra/backup/mailbox/2014/09/03/claudio@domain3.com/Emailed Contacts.tar /Inbox => /opt/zimbra/backup/mailbox/2014/09/03/claudio@domain3.com/Inbox.tar /Sent => /opt/zimbra/backup/mailbox/2014/09/03/claudio@domain3.com/Sent.tar Mail filters (in sieve format) => /opt/zimbra/backup/mailbox/2014/09/03/claudio@domain3.com/filters.sieve fabrizio@domain3.com /Emailed Contacts => /opt/zimbra/backup/mailbox/2014/09/03/fabrizio@domain3.com/Emailed Contacts.tar /Inbox => /opt/zimbra/backup/mailbox/2014/09/03/fabrizio@domain3.com/Inbox.tar /Sent => /opt/zimbra/backup/mailbox/2014/09/03/fabrizio@domain3.com/Sent.tar Mail filters (in sieve format) => /opt/zimbra/backup/mailbox/2014/09/03/fabrizio@domain3.com/filters.sieve ham.zklkasxj@domain3.com Nothing to backup here... Mail filters (in sieve format) => /opt/zimbra/backup/mailbox/2014/09/03/ham.zklkasxj@domain3.com/filters.sieve spam.dhsk4dqd@domain3.com Nothing to backup here... Mail filters (in sieve format) => /opt/zimbra/backup/mailbox/2014/09/03/spam.dhsk4dqd@domain3.com/filters.sieve galsync.xpxdcsd5wu@domain3.com Nothing to backup here... Mail filters (in sieve format) => /opt/zimbra/backup/mailbox/2014/09/03/galsync.xpxdcsd5wu@domain3.com/filters.sieve virus-quarantine.fihed1fyd@domain3.com Nothing to backup here... Mail filters (in sieve format) => /opt/zimbra/backup/mailbox/2014/09/03/virus-quarantine.fihed1fyd@domain3.com/filters.sieve info@domain4.com /Emailed Contacts => /opt/zimbra/backup/mailbox/2014/09/03/info@domain4.com/Emailed Contacts.tar ERROR: zclient.IOERROR (Unable to get REST resource from http://mail.domain4.com/home/info@domain4.com/Emailed%20Contacts?fmt=tar: Connection refused) (cause: java.net.ConnectException Connection refused) ERROR : Unable to backup folder /Emailed Contacts, skipping /Inbox => /opt/zimbra/backup/mailbox/2014/09/03/info@domain4.com/Inbox.tar ERROR: zclient.IOERROR (Unable to get REST resource from http://mail.domain4.com/home/info@domain4.com/Inbox?fmt=tar: Connection refused) (cause: java.net.ConnectException Connection refused) ERROR : Unable to backup folder /Inbox, skipping /Sent => /opt/zimbra/backup/mailbox/2014/09/03/info@domain4.com/Sent.tar ERROR: zclient.IOERROR (Unable to get REST resource from http://mail.domain4.com/home/info@domain4.com/Sent?fmt=tar: Connection refused) (cause: java.net.ConnectException Connection refused) ERROR : Unable to backup folder /Sent, skipping Mail filters (in sieve format) => /opt/zimbra/backup/mailbox/2014/09/03/info@domain4.com/filters.sieve test@domain4.com /Inbox => /opt/zimbra/backup/mailbox/2014/09/03/test@domain4.com/Inbox.tar ERROR: zclient.IOERROR (Unable to get REST resource from http://mail.domain4.com/home/test@domain4.com/Inbox?fmt=tar: Connection refused) (cause: java.net.ConnectException Connection refused) ERROR : Unable to backup folder /Inbox, skipping Mail filters (in sieve format) => /opt/zimbra/backup/mailbox/2014/09/03/test@domain4.com/filters.sieve galsync@domain4.com /_zimbra => /opt/zimbra/backup/mailbox/2014/09/03/galsync@domain4.com/_zimbra.tar ERROR: zclient.IO_ERROR (Unable to get REST resource from http://mail.domain4.com/home/galsync@domain4.com/_zimbra?fmt=tar: Connection refused) (cause: java.net.ConnectException Connection refused) ERROR : Unable to backup folder /zimbra, skipping _ Mail filters (in sieve format) => /opt/zimbra/backup/mailbox/2014/09/03/galsync@domain4.com/filters.sieve galsync@domain5.com Nothing to backup here... Mail filters (in sieve format) => /opt/zimbra/backup/mailbox/2014/09/03/galsync@domain5.com/filters.sieve galsync@domain6.com Nothing to backup here... _ Mail filters (in sieve format) => /opt/zimbra/backup/mailbox/2014/09/03/galsync@domain6.com/filters.sieve
I tried only backup function, I haven't tried restore backups yet
Hi again.
So now we don't have the bash error and I see more clearly the problem you have.
Apparently, you are running a multiple server configuration, and the issue is you can't reach the REST API on those servers (the error messages on Zimbra tools are quite wrong and "Connection refused" simply means zmmailbox cant reach the REST API).
As the zimbra user, list all servers with the command zmprov gas
and try to use the ping
command on them.
If the ping command is answering something like "ping: unknown host...", then try adding the ip and host combination to your /etc/hosts file and then try the following command : /opt/zimbra/bin/zmmailbox -z -m test@domain4.com getAllFolders
This is the kind of command used my the script, so if it's succeed, there's a big chance of the script succeeding.
By the way, I'm reopening this issue.
Thanks.
zimbra@myserver:/$ zmprov gas mail.myserver.com zimbra@myserver:/$ ping mail.myserver.com PING mail.myserver.com (192.168.1.53) 56(84) bytes of data. 64 bytes from mail.myserver.com (192.168.1.53): icmp_req=1 ttl=64 time=0.017 ms 64 bytes from mail.myserver.com (192.168.1.53): icmp_req=2 ttl=64 time=0.039 ms 64 bytes from mail.myserver.com (192.168.1.53): icmp_req=3 ttl=64 time=0.042 ms
I have only one server on the same machines: mail.myserver.com
Ok, strange, because zmmailbox uses this value to find the REST API server to query to.
Could you try explicitely add the server to the last command I gave by adding "-h http://192.168.1.53" like /opt/zimbra/bin/zmmailbox -h http://192.168.1.53 -z -m test@domain4.com getAllFolders
?
If this works, maybe there's some misconfiguration on your zimbra instance.
Thanks.
zimbra@myserver:/$ zmmailbox -u http://192.168.1.53 -z -m test@domain4.com getAllFolders Id View Unread Msg Count Path
1 unkn 0 0 /
16 docu 0 0 /Briefcase
10 appo 0 0 /Calendar
14 mess 0 0 /Chats
7 cont 0 0 /Contacts
6 mess 0 0 /Drafts
13 cont 0 0 /Emailed Contacts
2 mess 0 3 /Inbox
4 mess 0 0 /Junk
5 mess 0 0 /Sent
15 task 0 0 /Tasks
3 unkn 0 0 /Trash
Ok, so when the URL is set, it works.
Could you run the following command : /opt/zimbra/bin/zmmailbox -d -z -m test@domain4.com getAllFolders
?
It will fail, but you will see some debug "SOAP RECEIVE" and "SOAP SEND", could you paste these parts ?
Thanks.
zimbra@myserver:/$ zmmailbox -d -z -m test@domain4.com ========== SOAP SEND ==========
Here we are :).
Even though the XML markup was eaten by github, I can see some problems.
You see those 3 lines ? : http://mail.forlini.it:80/service/soap/ https://mail.forlini.it:7071/service/admin/soap/ http://mail.domain4.com
Actually, those 3 lines should contain "mail.myserver.com" instead of "mail.forlini.it" and "mail.domain4.com".
I think you imported the Zimbra you have in production to a virtual machine to perform some tests, and it seems Zimbra kept some "old" configuration settings.
You have 2 ways to correct this :
Thanks.
Sorry, I forget to mask my server name so I edited previous post. I haven't imported but yes, I'm running Zimbra on a OpenVZ CT.
Anyway... Hit, my fault! I added entry "mail.domain4.com" on my /etc/hosts file just to try if it works and... it works!
Now I'm trying to do "more clean way" that you suggest.
Thank you
How restore backups works?
Hi. For the restore process, it has to be performed with the zmmailbox tool (http://wiki.zimbra.com/wiki/Zmmailbox) with the postRestURL command.
Something like /opt/zimbra/bin/zmmailbox -z -m user@domain.com -t 0 postRestURL “//?fmt=tgz&resolve=reset" account.tgz
should work, but be
carefull (mostly with the resolve parameter, when set to "reset", it
will empty the destination mailbox and replace it with the TGZ dump. If
you can work with a test zimbra, don't hesitate to test it, I've done a
lot of mistakes when testing.
It's scheduled to include a restore functionnality in zimbashckup, but I haven't the time to write it.
But I will add a section in the README file about restoring backups.
Thanks.
I just added a section on the README file.
Great! I'll try to restore backups.
Hi, I performed the steps above and get the following error: zmmailbox z -m user@domain.com getRestURL '/ ? fmt = tgz '> user@domain.com.tgz ERROR: zclient.IO_ERROR ( Unable to get REST resource from http://server1.domain.com/home/user@domain.com/?fmt=tgz : Connection refused) (cause : java.net .ConnectException Connection refused) Regards,
I run Zimbra on Ubuntu 12.04. Command is execute on the same Zimbra server
zimbra@myserver:/$ bashzimbashckup.sh -v
ERROR: zclient.IO_ERROR (Unable to get REST resource from http://mail.domain1.tld/home/galsync@domain1.tld/_zimbra?fmt=tar: Connection refused) (cause: java.net.ConnectException Connection refused) ERROR : Unable to backup folder /_zimbra, skipping
ERROR: zclient.IO_ERROR (Unable to get REST resource from http://mail.domain2.tld/home/galsync@domain2.tld/_zimbra?fmt=tar: Connection refused) (cause: java.net.ConnectException Connection refused) ERROR : Unable to backup folder /_zimbra, skipping
ERROR: zclient.IO_ERROR (Unable to get REST resource from http://mail.domain3.tld/home/galsync@domain3.tld/_zimbra?fmt=tar: Connection refused) (cause: java.net.ConnectException Connection refused) ERROR : Unable to backup folder /_zimbra, skipping
....
Further, I had to convert all ` with ' in the entire script.