[SOLVED] Yet Another Backup Script for Community Version

Discuss your pilot or production implementation with other Zimbra admins or our engineers.
raid3868
Posts: 4
Joined: Sat Sep 13, 2014 2:34 am

[SOLVED] Yet Another Backup Script for Community Version

Post by raid3868 »

Hi LaFong
I have used the backup script to backup and i move to a new server and restore.

The host / dns / ip OS version is same as my previous. I have successfully restored.
OS SLES 11 sp2 x64

zcs-7.2.0_GA_2669.SLES11_64.20120410001942
step.

Configuration same as previous server.

Install zimbra same version as previous.

zmcontrol stop.

rename /opt/zimbra_new

create /opt/zimbra

restore from backup using dar -x /tmp/15_ZimbraBackup_20120515_FULL -w -R /opt/zimbra

after restore.

zmcontrol start
zimbra@mail0:~> zmcontrol start

Host mail0.example.com

Starting ldap...Done.

Failed.

Failed to start slapd. Attempting debug start to determine error.


/var/log/zimbralog
May 15 15:24:51 mail0 zimbramon[27277]: 27277:info: Starting services initiated by zmcontrol

May 15 15:24:51 mail0 sudo: zimbra : TTY=pts/2 ; PWD=/opt/zimbra ; USER=root ; COMMAND=/opt/zimbra/libexec/zmslapd -l LOCAL0 -u zimbra -h ldap://mail0.example.com:389 ldapi:/// -F /opt/zimbra/data/ldap/config

May 15 15:24:51 mail0 slapd[27323]: @(#) $OpenLDAP: slapd 2.4.30 (Mar 12 2012 17:10:23) $ build@zre-sles11-64:/home/build/p4/HELIX/ThirdParty/openldap/openldap-2.4.30.6z/servers/slapd

May 15 15:24:51 mail0 slapd[27324]: unable to open pid file "/opt/zimbra/openldap/var/run/slapd.pid": 13 (Permission denied)

May 15 15:24:51 mail0 slapd[27324]: slapd stopped.

May 15 15:24:51 mail0 slapd[27324]: connections_destroy: nothing to destroy.

May 15 15:24:56 mail0 sudo: zimbra : TTY=pts/2 ; PWD=/opt/zimbra ; USER=root ; COMMAND=/opt/zimbra/libexec/zmslapd -l LOCAL0 -u zimbra -h ldap://mail0.example.com:389 ldapi:/// -F /opt/zimbra/data/ldap/config

May 15 15:24:56 mail0 slapd[27327]: @(#) $OpenLDAP: slapd 2.4.30 (Mar 12 2012 17:10:23) $ build@zre-sles11-64:/home/build/p4/HELIX/ThirdParty/openldap/openldap-2.4.30.6z/servers/slapd

May 15 15:24:57 mail0 slapd[27328]: unable to open pid file "/opt/zimbra/openldap/var/run/slapd.pid": 13 (Permission denied)

May 15 15:24:57 mail0 slapd[27328]: slapd stopped.

May 15 15:24:57 mail0 slapd[27328]: connections_destroy: nothing to destroy.

May 15 15:25:02 mail0 sudo: zimbra : TTY=pts/2 ; PWD=/opt/zimbra ; USER=root ; COMMAND=/opt/zimbra/libexec/zmslapd -l LOCAL0 -u zimbra -h ldap://mail0.example.com:389 ldapi:/// -F /opt/zimbra/data/ldap/config

May 15 15:25:02 mail0 slapd[27334]: @(#) $OpenLDAP: slapd 2.4.30 (Mar 12 2012 17:10:23) $ build@zre-sles11-64:/home/build/p4/HELIX/ThirdParty/openldap/openldap-2.4.30.6z/servers/slapd

May 15 15:25:02 mail0 slapd[27335]: unable to open pid file "/opt/zimbra/openldap/var/run/slapd.pid": 13 (Permission denied)

May 15 15:25:02 mail0 slapd[27335]: slapd stopped.

May 15 15:25:02 mail0 slapd[27335]: connections_destroy: nothing to destroy.

May 15 15:25:07 mail0 sudo: zimbra : TTY=pts/2 ; PWD=/opt/zimbra ; USER=root ; COMMAND=/opt/zimbra/libexec/zmslapd -l LOCAL0 -u zimbra -h ldap://mail0.example.com:389 ldapi:/// -F /opt/zimbra/data/ldap/config

May 15 15:25:07 mail0 slapd[27338]: @(#) $OpenLDAP: slapd 2.4.30 (Mar 12 2012 17:10:23) $ build@zre-sles11-64:/home/build/p4/HELIX/ThirdParty/openldap/openldap-2.4.30.6z/servers/slapd

May 15 15:25:07 mail0 slapd[27339]: unable to open pid file "/opt/zimbra/openldap/var/run/slapd.pid": 13 (Permission denied)

May 15 15:25:07 mail0 slapd[27339]: slapd stopped.

May 15 15:25:07 mail0 slapd[27339]: connections_destroy: nothing to destroy.

May 15 15:25:12 mail0 sudo: zimbra : TTY=pts/2 ; PWD=/opt/zimbra ; USER=root ; COMMAND=/opt/zimbra/libexec/zmslapd -l LOCAL0 -u zimbra -h ldap://mail0.example.com:389 ldapi:/// -F /opt/zimbra/data/ldap/config

May 15 15:25:12 mail0 slapd[27342]: @(#) $OpenLDAP: slapd 2.4.30 (Mar 12 2012 17:10:23) $ build@zre-sles11-64:/home/build/p4/HELIX/ThirdParty/openldap/openldap-2.4.30.6z/servers/slapd

May 15 15:25:12 mail0 slapd[27343]: unable to open pid file "/opt/zimbra/openldap/var/run/slapd.pid": 13 (Permission denied)

May 15 15:25:12 mail0 slapd[27343]: slapd stopped.

May 15 15:25:12 mail0 slapd[27343]: connections_destroy: nothing to destroy.

May 15 15:25:17 mail0 sudo: zimbra : TTY=pts/2 ; PWD=/opt/zimbra ; USER=root ; COMMAND=/opt/zimbra/libexec/zmslapd -l LOCAL0 -u zimbra -h ldap://mail0.example.com:389 ldapi:/// -F /opt/zimbra/data/ldap/config

May 15 15:25:17 mail0 slapd[27346]: @(#) $OpenLDAP: slapd 2.4.30 (Mar 12 2012 17:10:23) $ build@zre-sles11-64:/home/build/p4/HELIX/ThirdParty/openldap/openldap-2.4.30.6z/servers/slapd

May 15 15:25:17 mail0 slapd[27347]: unable to open pid file "/opt/zimbra/openldap/var/run/slapd.pid": 13 (Permission denied)

May 15 15:25:17 mail0 slapd[27347]: slapd stopped.

May 15 15:25:17 mail0 slapd[27347]: connections_destroy: nothing to destroy.

May 15 15:25:22 mail0 sudo: zimbra : TTY=pts/2 ; PWD=/opt/zimbra ; USER=root ; COMMAND=/opt/zimbra/libexec/zmslapd -l LOCAL0 -u zimbra -h ldap://mail0.example.com:389 ldapi:/// -F /opt/zimbra/data/ldap/config

May 15 15:25:22 mail0 slapd[27350]: @(#) $OpenLDAP: slapd 2.4.30 (Mar 12 2012 17:10:23) $ build@zre-sles11-64:/home/build/p4/HELIX/ThirdParty/openldap/openldap-2.4.30.6z/servers/slapd

May 15 15:25:23 mail0 slapd[27351]: unable to open pid file "/opt/zimbra/openldap/var/run/slapd.pid": 13 (Permission denied)

May 15 15:25:23 mail0 slapd[27351]: slapd stopped.

May 15 15:25:23 mail0 slapd[27351]: connections_destroy: nothing to destroy.

May 15 15:25:28 mail0 sudo: zimbra : TTY=pts/2 ; PWD=/opt/zimbra ; USER=root ; COMMAND=/opt/zimbra/libexec/zmslapd -l LOCAL0 -u zimbra -h ldap://mail0.example.com:389 ldapi:/// -F /opt/zimbra/data/ldap/config -d 1

May 15 15:25:28 mail0 slapd[27357]: @(#) $OpenLDAP: slapd 2.4.30 (Mar 12 2012 17:10:23) $ build@zre-sles11-64:/home/build/p4/HELIX/ThirdParty/openldap/openldap-2.4.30.6z/servers/slapd

May 15 15:25:28 mail0 slapd[27357]: unable to open pid file "/opt/zimbra/openldap/var/run/slapd.pid": 13 (Permission denied)

May 15 15:25:28 mail0 slapd[27357]: slapd stopped.

May 15 15:25:28 mail0 slapd[27357]: connections_destroy: nothing to destroy.

May 15 15:26:04 mail0 sudo: zimbra : TTY=unknown ; PWD=/opt/zimbra ; USER=root ; COMMAND=/opt/zimbra/libexec/zmmailboxdmgr status

May 15 15:26:04 mail0 zmmailboxdmgr[27573]: status requested

May 15 15:26:04 mail0 zmmailboxdmgr[27573]: file /opt/zimbra/log/zmmailboxd_manager.pid does not exist

May 15 15:26:04 mail0 zmmailboxdmgr[27573]: assuming no other instance is running

May 15 15:26:04 mail0 zmmailboxdmgr[27573]: file /opt/zimbra/log/zmmailboxd.pid does not exist

May 15 15:26:04 mail0 zmmailboxdmgr[27573]: assuming no other instance is running

May 15 15:26:04 mail0 zmmailboxdmgr[27573]: no manager process is running

May 15 15:26:04 mail0 sudo: zimbra : TTY=unknown ; PWD=/opt/zimbra ; USER=root ; COMMAND=/opt/zimbra/libexec/zmmtastatus

Pls help Tks
raid3868
Posts: 4
Joined: Sat Sep 13, 2014 2:34 am

[SOLVED] Yet Another Backup Script for Community Version

Post by raid3868 »

Hi tks,
I have solve the problem and is very easy after all.
very thanks.
blason
Outstanding Member
Outstanding Member
Posts: 265
Joined: Sat Sep 13, 2014 2:13 am

[SOLVED] Yet Another Backup Script for Community Version

Post by blason »

Hi Folks,
HOw can I email that /var/log/zim_backup.log file directly to one of user Inbox. Since the script is written for Ubuntu the same stuff is not working for CentOS however I tried couple of other options with mail and mailx but in vain.
Any help would be appreciated.
liverpoolfcfan
Elite member
Elite member
Posts: 1111
Joined: Sat Sep 13, 2014 12:47 am

[SOLVED] Yet Another Backup Script for Community Version

Post by liverpoolfcfan »

[quote user="LaFong"]Try the commands below to identify the user.



sudo su - zimbra

source ~/bin/zmshutil ; zmsetvars

ldapsearch -x -H ldap://"$HOSTNAME" -D "$zimbra_ldap_userdn" -w "$zimbra_ldap_password" '(&(objectClass=zimbraAccount)(zimbraId=fbd258fb-f8c8-461e-84fa-754d642b5f21))'

[/QUOTE]
That worked great thanks.
I learned something else new about the zimbra innards as a result. This was a mailbox that had been created but had not yet received any emails. Seems zimbra only assigns the mailbox number and group number after the user first logs in.
LaFong
Outstanding Member
Outstanding Member
Posts: 221
Joined: Fri Sep 12, 2014 11:54 pm

[SOLVED] Yet Another Backup Script for Community Version

Post by LaFong »

[quote user="liverpoolfcfan"]That worked great thanks.
I learned something else new about the zimbra innards as a result. This was a mailbox that had been created but had not yet received any emails. Seems zimbra only assigns the mailbox number and group number after the user first logs in.[/QUOTE]

Seems you have an old version of that script. I did fix that issue, shown below. The latest version is at zmDBbac.sh
># : 0.5 alpha:

# - Automatically have Zimbra create a user's DB, if it doesn't exist (optional).

# - Alternately, log users who lack a DB, if AUTOCREATE_DB is set to "no".

# - Comment and text output changes for more clarity

# - Standardized script indentation

# : 0.6 alpha:

# - Fixed issue with hard coded path to skeleton.sql
Labsy
Outstanding Member
Outstanding Member
Posts: 411
Joined: Sat Sep 13, 2014 12:52 am

[SOLVED] Yet Another Backup Script for Community Version

Post by Labsy »

[quote user="raid3868"]Hi tks,
I have solve the problem and is very easy after all.
very thanks.[/QUOTE]Don't just write you solved the problem. Tell us how you did it and what you found out the problem was. Doing so you might help others with same problem. That's what forum is about.
nooto
Posts: 9
Joined: Sat Sep 13, 2014 2:56 am

[SOLVED] Yet Another Backup Script for Community Version

Post by nooto »

Hi !
It seems the zmbak_v.0.8.sh script can't be installed following the default instructions on Ubuntu 12.04 LTS with zimbra 8.
The problem is with "mailx" as mta-dummy_1.0_all.deb conflicts with zimbra.
cat: /opt/zimbra/backup.week: No such file or directory
'mailx' is not installed!
For a Howto install mailx without postfix please visit the link below


Should">http://www.zimbra.com/forums/administra ... #post70636
Should I try install this for you?
!! Only say yes if you are running Ubuntu!!
install y or n: y
Downloading mta-dummy package to /tmp

--2012-10-17 01:09:47-- http://ubuntu.lnix.net/misc/mta-dummy/m ... .0_all.deb

Resolving ubuntu.lnix.net (ubuntu.lnix.net)... 81.26.52.3

Connecting to ubuntu.lnix.net (ubuntu.lnix.net)|81.26.52.3|:80... connected.

HTTP request sent, awaiting response...

HTTP/1.1 200 OK

Server: nginx

Date: Tue, 16 Oct 2012 22:09:20 GMT

Content-Type: application/octet-stream

Content-Length: 2084

Last-Modified: Sat, 22 Apr 2006 20:22:51 GMT

Connection: keep-alive

Accept-Ranges: bytes

Length: 2084 (2.0K) [application/octet-stream]

Saving to: `mta-dummy_1.0_all.deb'
100%[==============================================================================================================================>] 2,084 --.-K/s in 0s
2012-10-17 01:09:48 (161 MB/s) - `mta-dummy_1.0_all.deb' saved [2084/2084]


Selecting previously unselected package mta-dummy.

dpkg: regarding mta-dummy_1.0_all.deb containing mta-dummy:

zimbra-mta conflicts with mail-transport-agent

mta-dummy provides mail-transport-agent and is to be installed.

dpkg: error processing mta-dummy_1.0_all.deb (--install):

conflicting packages - not installing mta-dummy

Errors were encountered while processing:

mta-dummy_1.0_all.deb

Had a problem installing mta-dummy, please ask for help in the forums


Does anybody know how to escape this problem, or should I just ignore mailx, install all the other required packages and disable mail sending in the script ??
Thanks !
N.
blason
Outstanding Member
Outstanding Member
Posts: 265
Joined: Sat Sep 13, 2014 2:13 am

[SOLVED] Yet Another Backup Script for Community Version

Post by blason »

Just curious to know if the said script is tested with Zimbra 8.0? Or was there any recent version rolled out?
Please confirm.
Brotherbbad
Posts: 15
Joined: Sat Sep 13, 2014 2:21 am

[SOLVED] Yet Another Backup Script for Community Version

Post by Brotherbbad »

Hi all,


Got the User Backup script (zmDBbac.sh) up and running via the provided instructions... works like a charm. Now I'd like to test the restore methods but I'm having either severe brain damage or this is just a bit over my head.... or both.
Can someone please explain to me the steps to restore a user that has been deleted? I have been trying to follow the instructions, (3. Restore the user's message store to /opt/zimbra/store/#/12,)... what, just create the deleted directory again? Then, (4. Restore the user's index to /opt/zimbra/index/#/12,) create this directory again also? If yes, I'm on track... but then (5. Place the user's .sql and .ldif backup files in the same directory.) where do I find these? Ya see I'm not the sharpest tool in the shed.
Please help!!!!
Thanks in advance.
Ron
drdre
Outstanding Member
Outstanding Member
Posts: 411
Joined: Fri Sep 12, 2014 10:43 pm

[SOLVED] Yet Another Backup Script for Community Version

Post by drdre »

Blason i havent been able to get it to work with 8 since it tries to install dummy-mta which i cant get install on ubuntu 12.04 lts
Post Reply