Page 50 of 66 FirstFirst ... 40484950515260 ... LastLast
Results 491 to 500 of 659

Thread: [SOLVED] Yet Another Backup Script for Community Version

  1. #491
    LaFong is offline Advanced Member
    Join Date
    Nov 2008
    Location
    Denver, CO
    Posts
    221
    Rep Power
    6

    Default

    Quote Originally Posted by 123456789 View Post
    Thank you for your time.
    At this moment nothing happed yet. Thanks God. But, just in case of ... you know ...
    Ah, good. Yes, you have to have been running the DB add-on to the main script to allow restoring of users or folders. (Though theoretically you could configure a temp server with a backup copy of all of zimbra, run the DB script on that to recover SQL, LDAP, messages, indexes, then take those and restore on your production server. That would be a pain.)

    I have changed the link in the instructions again. It's hard to find a free, anonymous place that will store your files indefinitely. Here is the link so you don't have to search in the original instructions:
    zmDBbac.zip
    Last edited by LaFong; 09-22-2011 at 08:29 PM.

  2. #492
    123456789 is offline New Member
    Join Date
    Jun 2011
    Posts
    3
    Rep Power
    4

    Default Filesystem space

    Quote Originally Posted by liverpoolfcfan View Post
    While my zimbra server has lots of space for keeping multiple weeks of backups, the remote server I use for offloading a copy does not. Twice I have ended up filling the hard drive on the remote system - causing problems on that server. So, I decided to see if I could figure out a way to make sure it doesn't happen again. This works for me, hopefully it might be of use to some of you too. It uses awk, and will only work if the remote system is also a linux system (I use it on CentOS)

    At the top of zmbak.sh - find the section
    Code:
    #--- SSH REMOTE DR COPY ---#
    # This option will secure copy your archives to a remote server via 'scp'
    DRCP="yes"		# valid answers are "yes" or "no"
    and add two more lines at the bottom of the section
    Code:
    REMOTEVOL="VolGroup00-LogVol00"     # volume on remote host where backups will be saved 
    REMOTEMINFREE=200000                # Required minimum 1K disks blocks free after copy (Approx 200MB in this case)
    Then, search to near the bottom of the script where you will find
    Code:
    	# DRCP Section. To scp newly created archives to a remote system
    	if [ "$DRCP" = "yes" ]
    	then
    After the "then", add the following code

    Code:
    		echo "Checking disk space on volume [$REMOTEVOL] on host [$REMOTEHOST]"
    		needed=$(find $ARCHIVEDIR -name "$ARCHIVENAME*" -exec ls -sk  {} \; | awk '{ s+=$1 } END { print s }')
    		avail=$(ssh $SSHUSER@$REMOTEHOST df -P -k | grep -i $REMOTEVOL | awk '{ print $4 }')
    		surplus=$(expr $avail - $needed)
    		if [ $surplus -ge $REMOTEMINFREE ]; then
    			echo "Avail:"$avail "- Needed:"$needed "- Surplus:"$surplus "- MinFree:"$REMOTEMINFREE "- OK TO COPY"
    			echo "Begin copy ..."
    		fi
    		if [ $surplus -lt $REMOTEMINFREE ]; then
    			echo "Avail:"$avail "- Needed:"$needed "- Surplus:"$surplus "- MinFree:"$REMOTEMINFREE "- CANNOT COPY"
    			echo "Error NOT ENOUGH SPACE AVAILABLE to copy backup files to $REMOTEHOST"
    			exit 1
    		fi
    This code will get the total number of 1K blocks needed to copy the current backup, and then the total number of 1K blocks available on the specified volume on the remote host. It then subtracts the needed from the available to give a surplus (which could be negative of course) and checks to see if that surplus is larger than the configured value for the minimum number of free blocks on the remote volume.

    NOTE: REMOTEVOL="VolGroup00-LogVol00"
    This does not need to be the complete volume name as listed by df (in my case that is /dev/mapper/VolGroup00-LogVol00) - it just needs to be enough to uniquely identify the volume from the df output.

    TODO: If anyone knows a way to find the remote volume name using the remote directory name - the configuration could be simplified further to just adding the Minimum Free Blocks setting. - Please reply back if there is way to do it.
    Do you use filesystem quota ? You should ... anyway you can run this script

    Code:
    :
    # @(#) -- show the filesystems short of space - JMS 03/06/2011 v1.0
    #
    
    #!/bin/sh
    
    # #########################
    # # Check Disk Space Utilization       #
    # # if >= 80% then alert sysadmin    #
    # #########################
    
    # NOTE
    
    # at the prompt of your tty type
    # the command what
    # and the name of this script whithout the extention .sh
    # exemple -> $ what alertfreespace
    # That's why the first 5 lines are so important
    
    
    LOGDIR=`pwd`
    LOGFILE=${LOGDIR}"/alertfreespace.log"
    #LOGFILE1=${LOGDIR}"/tmp.log"
    
    STDOUT=${LOGDIR}"/tmp1.log"
    MAINTLOG=${LOGDIR}"/tmp2.log"
    
    LOGFILEALL=${LOGDIR}"/resumo_all.log"
    DATA=`date +%d%b%Y_%Hh%M`
    COMANDOSDIR="/bin/"
    UPTIME=`/usr/bin/uptime | awk '{print $3}'`
    
    # ACTION: Check Disk Space Utilization
    #    Notify administrator if disk space utilization on any filesystem >= 80%
    #
    
    echo "" > ${LOGFILE}
    
    echo "*** custom alert ***" > ${MAINTLOG}
    echo "====================" >> ${MAINTLOG}
    
    ${COMANDOSDIR}df -t ext3 | awk '{if (int($5)>=80) {print $0}}' > ${STDOUT}
    
    if [ -s $STDOUT ] ; then
    
          echo "filesystems have >= 80% used :" >> ${MAINTLOG}
          echo "--------------------------------------------------" >> ${MAINTLOG}
          ${COMANDOSDIR}df -t ext3 | head -1 >> ${MAINTLOG}
          cat $STDOUT >> ${MAINTLOG}
    
    fi
    
    # ACTION: Check Inode Utilization
    #    Notify administrator if inode utilization on any filesystem >= 80%
    #
    
    ${COMANDOSDIR}df -i -t ext3 | awk '{if (int($5)>=80) {print $0}}' > ${STDOUT}
    
    if [ -s $STDOUT ] ; then
    
          echo "filesystems have >= 80% inode used :"   >> ${MAINTLOG}
          echo "--------------------------------------------------" >> ${MAINTLOG}
          ${COMANDOSDIR}df -i -t ext3 | head -1 >> ${MAINTLOG}
          cat $STDOUT >> $MAINTLOG
    
    fi
    
    echo "====================" >> ${MAINTLOG}
    cat $MAINTLOG >> ${LOGFILE}

  3. #493
    demanl is offline Loyal Member
    Join Date
    Feb 2006
    Location
    FL, USA
    Posts
    75
    Rep Power
    9

    Default

    Bravo Mr Heinzg and other script contributors.....very nice script indeed.

    But simple.....no.....very nice though.

    I am a linux novice.......and since coming from a windows world I am having trouble wrapping my mind around the ease at which you can do things in linux ...lol....so please...if my question in very noobish...plz consider the source...LOL...

    In the backup portion of the script...u have a hot sync rsync and a separate cold sync rsync portion....I understand the reasoning behind the COLD sync..and applaud it.....but what is the reasoning/purpose of the HOT sync...???

    Again kudos/applause for the very nice script and explanation of how it works..!!

  4. #494
    LaFong is offline Advanced Member
    Join Date
    Nov 2008
    Location
    Denver, CO
    Posts
    221
    Rep Power
    6

    Default

    Quote Originally Posted by demanl View Post
    In the backup portion of the script...u have a hot sync rsync and a separate cold sync rsync portion....I understand the reasoning behind the COLD sync..and applaud it.....but what is the reasoning/purpose of the HOT sync...???
    You do the hot sync so that the cold sync goes much faster. Users can continue to use the server while it is being hot-synced. The hot sync will often sync 90% or more of the data. When you then shut down Zimbra services to do the cold sync, there isn't much data left to sync, so downtime is much less than if you do only a cold sync.

  5. #495
    demanl is offline Loyal Member
    Join Date
    Feb 2006
    Location
    FL, USA
    Posts
    75
    Rep Power
    9

    Thumbs up

    Quote Originally Posted by LaFong View Post
    You do the hot sync so that the cold sync goes much faster. Users can continue to use the server while it is being hot-synced. The hot sync will often sync 90% or more of the data. When you then shut down Zimbra services to do the cold sync, there isn't much data left to sync, so downtime is much less than if you do only a cold sync.
    Awesome...pretty incredible.....tyvm for a quick replay......

  6. #496
    ciclonite is offline Beginner Member
    Join Date
    Jun 2011
    Posts
    1
    Rep Power
    4

    Default zmbak 0.8

    Hi,
    i'm a new user of Zimbra Community Edition v. 7.1.1 on Ubuntu 10.04 LTS 64Bit.
    Now i want to setup zmbak ver 0.8 to backup the ZCS.
    When i try to install the script (after configure it) with ./zmbak_v.0.8.sh --INSTALL
    it need to install mailx. On Ubuntu 10.04 the installation fail with this error:

    Code:
    ./zmbak_v.0.8.sh
    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
    http://www.zimbra.com/forums/administrators/13528-sending-email-comand-line-logwatch-ubuntu-6-06-a.html#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
    --2011-06-08 11:45:24--  http://ubuntu.lnix.net/misc/mta-dummy/mta-dummy_1.0_all.deb
    Resolving ubuntu.lnix.net... 81.26.52.3
    Connecting to ubuntu.lnix.net|81.26.52.3|:80... connected.
    HTTP request sent, awaiting response...
      HTTP/1.1 416 Requested Range Not Satisfiable
      Date: Wed, 08 Jun 2011 09:45:25 GMT
      Server: Apache
      Connection: close
      Content-Type: text/html; charset=iso-8859-1
    
        The file is already fully retrieved; nothing to do.
    
    
    (Reading database ... 92434 files and directories currently installed.)
    Preparing to replace mta-dummy 1.0 (using mta-dummy_1.0_all.deb) ...
    Unpacking replacement mta-dummy ...
    Setting up mta-dummy (1.0) ...
    
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Package mailx is a virtual package provided by:
      mailutils 1:2.1+dfsg1-4ubuntu1
      heirloom-mailx 12.4-1.1
      bsd-mailx 8.1.2-0.20090911cvs-2ubuntu1
    You should explicitly select one to install.
    E: Package mailx has no installation candidate
    Had a problem installing mailx, please ask for help in the forums
    I have not try to install one of this packages manually because im worry about the postfix installation.

    Any suggestion is appreciate.
    Thanks in advice.

  7. #497
    LaFong is offline Advanced Member
    Join Date
    Nov 2008
    Location
    Denver, CO
    Posts
    221
    Rep Power
    6

    Default Updated zmDBbac procedure

    I have updated my zmDBbac.sh script, Adding per user backup and restore, which allows per-user backup. The new version allows for multiple users per database. Zimbra creates a maximum of 100 user databases. User IDs above 100 share a database with other users. For example, user ID 112 would share the mboxgroup12 database with user ID 12. It is recommended that:


    1. Anyone using the script should download and update to this newer version. Other than swapping out the zmDBbac.sh script, the changes are entirely on the restore end.
    2. Any old backups made by the previous version of this script should be modified first before being used for a restore. This can be done with simple text edits. PM me if the need ever arises.
    3. I have not tested this script with ZCS v7.x yet. I plan on updating shortly. It is advisable not to use a v6 backup to restore to a v7 server, since Zimbra may have made some slight DB alterations. These are unlikely to affect the backup portion of the scripts.
    4. Do test restores on a test server. I have done several successfully, but would appreciate it if others would test and give feedback. Especially if you're using ZCS 7.x.
    5. I have updated the instructions in the original post, almost entirely concerning restores.


    Changes in this 0.4 Alpha version are:
    • Removed deletion of existing DB, since a DB can have multiple users
    • Created skeleton dump of just DB table structure, for restores to other servers where the DB does not exist
    • Delete and re-insert user's table rows, then optimize DB, instead of dropping and recreating DBs
    • Change email output to show both user id and DB name
    • Created restore_user.sh script to automate restore process

  8. #498
    LaFong is offline Advanced Member
    Join Date
    Nov 2008
    Location
    Denver, CO
    Posts
    221
    Rep Power
    6

    Default RE: Updated zmDBbac procedure

    I have now tested a few user restores with v7.1.2, and they appear to have worked fine.

    • I have placed an updated version of the zip file containing the scripts at the same link, zmDBbac.zip.
    • This update contains mainly cosmetic changes to the restore_user.sh script. The zmDBbac.sh script was not changed.
    • The changes to restore_user.sh make things clearer when restoring, hopefully, so you should download the new version.
    • When restoring, you will get messages like
      Table does not support optimize, doing recreate + analyze instead
      This is because Zimbra 7.x has changed its version of MySQL. These messages may be ignored.

  9. #499
    kazooless is offline Loyal Member
    Join Date
    Mar 2009
    Posts
    91
    Rep Power
    6

    Default Need Help Restoring a File

    Hello,

    I have been backing up with this script (zmbak_v.0.8.sh). After I upgraded to 7.1.2 I lost my spam configs, even though the file said that it was the right place to make changes leading me to believe that it would overwrite my edits.

    Anyway, I just need to recover one file and the time since the backup has been a while so I only have the files in the "burn" directory. How do I access these files to retrieve one file? (:/opt/zimbra/conf/spamassassin/local.cf)

    Thanks,

    kazoo

  10. #500
    LaFong is offline Advanced Member
    Join Date
    Nov 2008
    Location
    Denver, CO
    Posts
    221
    Rep Power
    6

    Default

    Quote Originally Posted by kazooless View Post
    Hello,

    I have been backing up with this script (zmbak_v.0.8.sh). After I upgraded to 7.1.2 I lost my spam configs, even though the file said that it was the right place to make changes leading me to believe that it would overwrite my edits.

    Anyway, I just need to recover one file and the time since the backup has been a while so I only have the files in the "burn" directory. How do I access these files to retrieve one file? (:/opt/zimbra/conf/spamassassin/local.cf)
    So, you have the dar files in the burn directory? Here is a tutorial on dar:
    DAR - Tutorial

    You would likely get the local.cf file from the FULL dar file. If the file was named, for example, 37_Zimbra_Backup_12-September-2011_FULL.1.dar, you could extract local.cf with this command:
    Code:
    cd /tmp
    dar -R / -x /Backup/burn/37_Zimbra_Backup_12-September-2011_FULL -g conf/spamassassin/local.cf
    Notice that you leave out the ".1.dar" part of the filename. You will now have the restored file in /tmp/conf/spamassassin/local.cf

Page 50 of 66 FirstFirst ... 40484950515260 ... LastLast

Thread Information

Users Browsing this Thread

There are currently 2 users browsing this thread. (0 members and 2 guests)

Similar Threads

  1. Zimbra Backup Script ... Small Problem
    By frankb in forum Administrators
    Replies: 12
    Last Post: 07-14-2008, 08:40 AM
  2. Debian - Upgrade from 4.5.6
    By magikman in forum Installation
    Replies: 1
    Last Post: 01-19-2008, 12:59 PM
  3. Backup script issues
    By SSS in forum Administrators
    Replies: 18
    Last Post: 12-03-2007, 09:56 AM
  4. 4.0.4 to 4.5.6 upgrade failed in network edition
    By chenthil in forum Administrators
    Replies: 1
    Last Post: 08-27-2007, 09:36 AM
  5. [SOLVED] Simple backup question...
    By dameron in forum Administrators
    Replies: 3
    Last Post: 08-25-2007, 09:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •