Page 62 of 67

[SOLVED] Yet Another Backup Script for Community Version

Posted: Thu Dec 27, 2012 8:25 am
by m0ps
[QUOTE]SHELL=/bin/bash

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

30 18 * * 1 /bin/bash /opt/scripts/zmbak_v.0.8.sh -f > /var/log/zim_backup.log 2>&1

35 22 * * 2-7 /bin/bash /opt/scripts/zmbak_v.0.8.sh -d >> /var/log/zim_backup.log 2>&1[/QUOTE]

it in root's crontab? if it in /etc/crontab it may be
[QUOTE]SHELL=/bin/bash

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

30 18 * * 1 root /bin/bash /opt/scripts/zmbak_v.0.8.sh -f > /var/log/zim_backup.log 2>&1

35 22 * * 2-7 root /bin/bash /opt/scripts/zmbak_v.0.8.sh -d >> /var/log/zim_backup.log 2>&1[/QUOTE]

[SOLVED] Yet Another Backup Script for Community Version

Posted: Mon Jan 07, 2013 7:52 am
by liverpoolfcfan
I am still running 7.2.1 of zimbra for the moment but have seen several posts about people having issues with rsync based backups since upgrading to version 8.0.n - all to do with a new sparse 85GB data.mdb file
Perhaps a solution to the problem would be to add/modify the functionality of the script as follows:
1. Prior to running rsync - perform a backup of the LDAP database using the approved technique putting the backup somewhere within the /opt/zimbra folder tree - For Ref https://bugzilla.zimbra.com/show_bug.cgi?id=78781#c4
2. add a specific exclude to the rsync command(s) --exclude=/opt/zimbra/data/ldap/mdb/db/data.mdb (I believe that is the path to the offending file)
I believe this would provide a backup of the ldap and would stop the rsync from hanging for a long period of time while trying to figure out what the contents of the data.mdb are - and would also prevent the backup from failing due to an "apparent" lack of disk space.

[SOLVED] Yet Another Backup Script for Community Version

Posted: Mon Jan 07, 2013 3:21 pm
by 6233maxxer
anyone knows how to restore, after modifying the script this way?

I mean, in the past unzipping all the backed up stuff was enought to restore Zimbra from this backup.

How to deal with the missing ldap data after this?

Could it be:



unzip stuf

su - zimbra

ldap start

/opt/zimbra/libexec/zmslapadd

ldap stop

zmcontrol start


[SOLVED] Yet Another Backup Script for Community Version

Posted: Mon Jan 21, 2013 7:28 am
by bma
Hi blason,

Have you solved your crontab problem. I am facing the same issue.

the crontab worked fine for a long time, but when I changed the backup path, I got the Stopping mailbox...Failed error.

[SOLVED] Yet Another Backup Script for Community Version

Posted: Thu Jan 24, 2013 4:08 am
by xenonsky
I'm facing the exact same issue after updated from 8.0.1 to 8.0.2, anyone have a working example of the modified backup script can share please !

[SOLVED] Yet Another Backup Script for Community Version

Posted: Tue Jan 29, 2013 9:42 am
by bma
[quote user="xenonsky"]I'm facing the exact same issue after updated from 8.0.1 to 8.0.2, anyone have a working example of the modified backup script can share please ![/QUOTE]
this works to me: add zimbra to PATH

SHELL=/bin/bash

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/zimbra/bin:/opt/zimbra/postfix/sbin:/opt/zimbra/openldap/bin:/opt/zimbra/snmp/bin:/opt/zimbra/rsync/bin:/opt/zimbra/bdb/bin:/opt/zimbra/openssl/bin:/opt/zimbra/java/bin

[SOLVED] Yet Another Backup Script for Community Version

Posted: Sat Feb 02, 2013 10:13 am
by xenonsky
[quote user="bma"]this works to me: add zimbra to PATH

SHELL=/bin/bash

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/zimbra/bin:/opt/zimbra/postfix/sbin:/opt/zimbra/openldap/bin:/opt/zimbra/snmp/bin:/opt/zimbra/rsync/bin:/opt/zimbra/bdb/bin:/opt/zimbra/openssl/bin:/opt/zimbra/java/bin[/QUOTE]
Thanks for the tips, I've just added the path to /etc/crontab and rebooted, then manually try to run a full backup and still got the same error:
Doing a hotsync of /opt/zimbra/ to /tmp/fakebackup/

rsync: writefd_unbuffered failed to write 4 bytes to socket [sender]: Broken pipe (32)

rsync: write failed on "/tmp/fakebackup/data/ldap/mdb/db/data.mdb": No space left on device (28)

rsync error: error in file IO (code 11) at receiver.c(301) [receiver=3.0.6]

rsync: connection unexpectedly closed (981 bytes received so far) [sender]

rsync error: error in rsync protocol data stream (code 12) at io.c(600) [sender=3.0.6]

rsync threw a hotsync error. this is not unusual, continuing...
any modification required for the original zmbak_v.0.8.sh script?
Thanks!

[SOLVED] Yet Another Backup Script for Community Version

Posted: Mon Feb 04, 2013 11:16 pm
by blason
Well that actaully did not resolve the issue but I done the trick and so far backup is running fine.
I commented out a original zimbra stop line and added
zmmailboxd stop && /etc/init.d/zimbra stop

[SOLVED] Yet Another Backup Script for Community Version

Posted: Sat Feb 09, 2013 3:11 am
by xenonsky
Blason,

Do you mean changing the following section from the zmback_v.0.8.sh ?
# Stopping Zimbra

echo "Stopping the Zimbra server..."

echo

su - $ZM_USER -c $ZM_HOME"bin/zmcontrol stop"

if [ "$?" -eq "1" ]

then

echo "zmcontrol shutdown had an error!"

mail_log

exit 1

fi


to the following:


# Stopping Zimbra

echo "Stopping the Zimbra server..."

echo

#su - $ZM_USER -c $ZM_HOME"bin/zmcontrol stop"

zmmailboxd stop && /etc/init.d/zimbra stop

if [ "$?" -eq "1" ]

then

echo "zmcontrol shutdown had an error!"

mail_log

exit 1

fi

[SOLVED] Yet Another Backup Script for Community Version

Posted: Sat Feb 09, 2013 3:36 am
by TheChief79
Last time i had to backup and restore my Zimbra 8.0.2. For the ldap database i used the tool mdb_copy which is included in zimbra.
So maybe this is a good way:
1. rsync zimbra to backup directory and exclude ldap db (maybe --exclude=/opt/zimbra/data/ldap/mdb/db/data.mdb)

2. Stop zimbra and copy the ldap database with mdb_copy (usage: mdb_copy srcpath dstpath). This will not copy the whole sparse file, it will copy the real size file.

3. Maybe rsync again

4. Start zimbra
mdb_copy worked great for me.
To restore on a new server:
1. I installed Zimbra (same verison) with ./install.sh -s

2. Moved the new Installation with mv /opt/zimbra /opt/zimbra_new

3. Copied the backup into /opt/zimbra

4. Started Zimbra

5. Ran the installer again with ./install.sh
Works!