Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
 
Go Back   Zimbra - Forums > Zimbra Collaboration Suite > Migration

Welcome to the Zimbra - Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack (5) Thread Tools Display Modes
  #201 (permalink)  
Old 07-16-2009, 01:11 AM
New Member
 
Posts: 3
Default

Hi tiger2000,

Thanks for the info: it's working !
Bye

Guillaume
Reply With Quote
  #202 (permalink)  
Old 08-14-2009, 09:46 AM
Special Member
 
Posts: 173
Talking

try this for migration of LDAP,mysql and zimbra

from zimbra to zimbra

Regards
Adeel
Reply With Quote
  #203 (permalink)  
Old 08-14-2009, 09:55 AM
raj raj is offline
Moderator
 
Posts: 435
Default

@adeelarifbhatti
seen your post to migrate zimbra..there are issues with it i will spend some time and write it up for you.
This thread i started 4 years back is to try to come up with "HOT" backup of OSS version.
We have tons of good ways to cold backup by "shutting down" zimbra (your is one of it)

Raj
__________________
i2k2 Networks
Dedicated & Shared Zimbra Hosting Provider
Reply With Quote
  #204 (permalink)  
Old 08-19-2009, 08:26 AM
Starter Member
 
Posts: 1
Default Restore

Is there a restore procedure?


Quote:
Originally Posted by mmarodin View Post
This is a per-user full backup script (based on mubley's code, 2005), for Zimbra 5.x. Zimbra DB and LDAP are also included.
I've tested it on 5.0.12 version.

I don't want to use ...
Code:
/opt/zimbra/bin/zmmailbox -z -m user@domain.com getRestURL “//?fmt=tgz” > /tmp/account.tgz
... because with this backup job I could not restore single messages, but only full mailbox.

I hope it could be usefull for you!

Code:
#!/bin/sh
#--------

# Backup Zimbra Open Source 5.x
# by mm@rodin - 20090206

# Modify the following variables to suit your installation
export time=`date +%y%m%d`
export backup_dir=/opt/backup
export zimbra_dir=/opt/zimbra
export index_dir=$zimbra_dir/index
export store_dir=$zimbra_dir/store

# We need mysqldump.  If it doesn't exist,
# copy mysql and modify it to call mysqldump.
if [ ! -e $zimbra_dir/bin/mysqldump ]; then
   cp $zimbra_dir/bin/mysql $zimbra_dir/bin/mysqldump
   sed -i 's|/bin/mysql |/bin/mysqldump |g' $zimbra_dir/bin/mysqldump
fi

# Create the backup directory
mkdir -p $backup_dir

# Get a list of all accounts and execute
# the contents of the for-loop for each account.
for i in `$zimbra_dir/bin/zmprov gaa` ; do

# Beginning of for-loop

#  Use email address to get zimbra_id
   zimbraId=`$zimbra_dir/bin/zmprov ga $i |grep zimbraId |sed 's|zimbraId: ||g'`
   set $zimbraId

#  Use mysql to get number id
   zimbra_nr=`$zimbra_dir/bin/mysql -e "use zimbra; select id from mailbox where account_id = '$1'"`
   zimbra_nr=`echo $zimbra_nr | sed 's|id ||g'`

#  Check to make sure we got a valid number id
   if [ "$zimbra_nr" = "" ]; then
      echo $i has no mailbox.
   else

#     Set zimbraAccountStatus to "maintenance"
      $zimbra_dir/bin/zmprov ma $i zimbraAccountStatus maintenance

#     Marking user backup
      if [ ! -e $backup_dir/info-$zimbra_nr.txt ]; then
         echo "Zimbra ID:	$1" > $backup_dir/info-$zimbra_nr.txt
         echo "Mail address:	$i" >> $backup_dir/info-$zimbra_nr.txt
      fi

#     Backup index and store files
      tar -czf $backup_dir/$time-$zimbra_nr-data.tgz $zimbra_dir/index/0/$zimbra_nr $zimbra_dir/store/0/$zimbra_nr

#     Backup Mysql db
      $zimbra_dir/bin/mysqldump mboxgroup$zimbra_nr > $backup_dir/$time-$zimbra_nr.dump
      tar -czf $backup_dir/$time-$zimbra_nr.dump.tgz $backup_dir/$time-$zimbra_nr.dump
      rm -f $backup_dir/$time-$zimbra_nr.dump

#     Set zimbraAccountStatus to "active"
      $zimbra_dir/bin/zmprov ma $i zimbraAccountStatus active

#  End of if statement
   fi

# End of for-loop
done

# Backup Zimbra master database and LDAP accounts database
# First, set all accounts to maintenance.
for i in `$zimbra_dir/bin/zmprov gaa` ; do
   $zimbra_dir/bin/zmprov ma $i zimbraAccountStatus maintenance
done

$zimbra_dir/bin/mysqldump zimbra  > $backup_dir/$time-zimbra.dump
tar -czf $backup_dir/$time-zimbra.dump.tgz $backup_dir/$time-zimbra.dump
rm -f $backup_dir/$time-zimbra.dump

$zimbra_dir/bin/zmslapcat > $backup_dir/$time-zimbra.ldap
tar -czf $backup_dir/$time-zimbra.ldap.tgz $backup_dir/$time-zimbra.ldap
rm -f $backup_dir/$time-zimbra.ldap

# Setting all accounts to active mode.
for i in `$zimbra_dir/bin/zmprov gaa` ; do
   $zimbra_dir/bin/zmprov ma $i zimbraAccountStatus active
done

# Backup complete
Reply With Quote
  #205 (permalink)  
Old 08-25-2009, 10:53 AM
Special Member
 
Posts: 107
Default

@ Raj.
In this case, where do you store the script written to backup all the users, backup a single user, and restore? I was thinking it should be in the /etc/cron
Please let me know I am trying to test this backup scenario. Especially the remote backup at 3am to another location within my network.

thanks
Reply With Quote
  #206 (permalink)  
Old 08-25-2009, 07:44 PM
raj raj is offline
Moderator
 
Posts: 435
Default

@borngunners: I guess you ment to ask this Q to the orignal poster of the script in this thread. i did not write the script or used it.

Full Server Backup and Restore of “open source version”

Raj
__________________
i2k2 Networks
Dedicated & Shared Zimbra Hosting Provider
Reply With Quote
Reply


Thread Tools
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

Zimbrablog.com




 

Search Engine Optimization by vBSEO 3.1.0