Results 1 to 5 of 5
  1. #1

    back up utility for linux box

    I am not planning to use cpanel. Thus I am searching for back up utility for linux box. Anyone can recommend any back up utility software which can back up and restore from one server to another server for home directory, mysql database and emails?

  2. #2
    I would use rsync for pretty much any linux/*nix related backup job. Google for rsync , and read up on the man pages for it.

    It is a great tool, and the best part is that it only will transfer the portions of the files that have been modified since the last backup took place.

    Peter
    The Maag Group - Intelligent IT Solutions
    • Colocation • Dedicated Servers • Server Administration •
    www.maaggroup.com • 877.622.4477

  3. #3
    Personally, I just use a simple shell script to backup /home/ to a mounted NFS drive. However, I do recall seeing an advert in linux format....Ahh yes, here it is...storix.com 30day trial or free for personal use.

  4. #4
    Couple suggestions:

    1) Rsync over SSH - rsync uses compression, and only sends the bits in the file that have changed. Set this up with an incremental backup script of some kind and you have an IDEAL solution.

    2) NFS mounted from autofs - no need to maintain a persistant mount, it mounts on demand when its time to make backups.
    "The only difference between a poor person and a rich person is what they do in their spare time."
    "If youth is wasted on the young, then retirement is wasted on the old"

  5. #5
    Join Date
    Apr 2002
    Location
    Philly Pa
    Posts
    130
    rsync = rlogin = danagous on a linux machine.

    ssh keys would be the best unless you have a nfs mount.

    I use a nfs mount and the mount is acrossed pier to pier nics, with rpc's binded to the internal addresses.

    Use AMD-utils for mapping nfs so its not a steady mount.

    Backup script i wrote and use daily. It doesnt restore, its a simple backup with diffs.
    Code:
    #!/bin/bash
    
    
    
            # conf files for backups.
            paths="/data/backup/conf"
            # full backup dir
            bdir="/data/backup/full"
            # diffs backup dir
            ddir="/data/backup/diff"
            # index of files.
            index="$paths/index.dat"
    
    
    host=`hostname`
    email="chris@jynx.net"
    
            bdate=`date +%m%d%Y`
    
            backupdir=(/export/web/people)
            ignorefiles=(logs)
    
            # put n for no, y for yes
            dosystemfiles="y"
            systemfiles=(/q/qmail /data/bin /www /bzImage /System.map /boot)
    
    
                    # system commands.
                    rm=`which rm`
                    touch=`which touch`
                    tar=`which tar`
                    mv=`which mv`
                    cp=`which cp`
                    ls=`which ls`
                    cat=`which cat`
                    mkdir=`which mkdir`
    
                    if [ "$rm" == "" ]; then
                            echo "no rm found in your path" ; exit ; fi
                            if [ "$touch" == "" ]; then
                                    echo "no touch found in your path" ; exit ; fi
                                    if [ "$tar" == "" ]; then
                                            echo "no tar found in your path" ; exit ; fi
                    if [ "$mv" == "" ]; then
                            echo "no mv found in your path" ; exit ; fi
                            if [ "$cp" == "" ]; then
                                    echo "no cp found in your path" ; exit ; fi
                                    if [ "$ls" == "" ]; then
                                            echo "no ls found in your path" ; exit ; fi
                                            if [ "$cat" == "" ]; then
                                                    echo "no cat found in your path" ; exit ; fi
                                                    if [ "$mkdir" == "" ]; then
                                                            echo "no mkdir found in your path" ; exit ; fi
    
                    useraccount=`id | awk '{print $1}' | grep root |wc -l`
                    if [ "$useraccount" -lt 1 ]
                    then
                            echo
                            echo "You must be root to run this."
                            echo
                            exit
                    fi
    
    
            if [ "$dosystemfiles" = "y" ]; then
            scount=${#systemfiles[@]}
            scounts=0
            if [ "$scount" -gt 0 ]; then
    
                    if [ ! -d $bdir/systemfiles/$bdate ]; then
                    mkdir $bdir/systemfiles/$bdate
                    fi
    
                    while [ "$scount" -gt $scounts ]
                    do
                    cp -rp ${systemfiles[$scounts]} $bdir/systemfiles/$bdate
                    cd $bdir/systemfiles
                    echo "System Files: ${systemfiles[$scounts]}" >> /tmp/sysstat
                    let scounts=scounts+1
                    done
    
                    tarsys=`tar -cvf systemfiles.$bdate.tar $bdate`
                    gzips=`gzip systemfiles.$bdate.tar`
    
            fi
            fi
    
    
    
                    if [ "$1" = "full" ]; then
                            rm $paths/full/*.index
                    fi
    
                    # count the array
                    count=${#backupdir[@]}
                    counts=0
    
            if [ "$count" -gt 0 ]; then
    
                    echo -n > $index 
    
                    while [ "$count" -gt $counts ]
                    do
    
                    for dir in $( ls ${backupdir[$counts]} )
                    do
                            # ok we now have our dirs to backup
                            # lets build a index for this dir.
    
    
                    if [ ! -f $paths/full/$dir.index ]; then
                            # no index of this dir, lets index it.
    
                    echo -n "Indexing $dir "
                    find ${backupdir[$counts]}/$dir > $paths/full/$dir.index
    
                    numfiles=`cat $paths/full/$dir.index | wc -l`
                    numfiles=`echo $numfiles | sed "s/      //g"`
    
                    echo "  ..done ($numfiles files)"
                            echo "Dir: ${backupdir[$counts]}/$dir ($numfiles files)" >> $index
    
                            echo "Dir: ${backupdir[$counts]}/$dir ($numfiles files)" >> /tmp/mailstat.full
    
    
    
                            # lets tar now.
                            echo -n "(Full) Tar: $dir "
    
                            if [ ! -d $bdir/$bdate ]; then
                            mkdir $bdir/$bdate
                            fi
    
                            cd $bdir/$bdate
                            tarit=`$tar -cvf $dir.$bdate.tar ${backupdir[$counts]}/$dir 1> /dev/null 2> /dev/null`
                            tarit=`/bin/gzip $dir.$bdate.tar 1> /dev/null 2> /dev/null`
                            echo "  ..done"
    
                    else 
    
                    if [ ! -d $ddir/$bdate ] ; then
                    # this is to store the diffs per date
                    mkdir $ddir/$bdate
                    fi
                    if [ ! -d $paths/diff/$bdate ] ; then
                    # this is for the index diffs.
                    mkdir $paths/diff/$bdate
                    fi
    
    
                    if [ -f $paths/diff/$bdate/$dir.index ]; then
                            echo "Index exists for this dir. ($dir)"
                    else
    
                    echo "Indexing $dir"
                    find ${backupdir[$counts]}/$dir -type f -daystart -ctime 1 | grep -v logs >> $paths/diff/$bdate/$dir.index
                            getnum=`cat $paths/diff/$bdate/$dir.index | wc -l`
                            getnum=`echo $getnum | sed "s/  //g"`
    
                    if [ "$getnum" -gt 0 ]; then
                            # found new files for $dir
    
                            echo "new files for $dir"
    
                            cd $ddir/$bdate
    
                    tardiff=`tar -cvf $dir.$bdate.diff.tar -T $paths/diff/$bdate/$dir.index 1> /dev/null 2> /dev/null`
    
                    echo "Dir ${backupdir[$counts]}/$dir ($getnum files)" >> /tmp/mailstat.diff
    
                    else
                            echo "Nothing new to backup for ($dir)"
                    fi
    
    
                    fi
    
    
                    fi
    
    
    
                    done
                    let counts=counts+1
                    done
    
            else
    
                    echo "No dirs to backup."
                    exit
    
            fi
    
    
    
            if [ -f /tmp/mailstat.full ]; then
    
    chris=`$cat /tmp/mailstat.full`
    if [ -f /tmp/sysstat ]; then
    sysis=`$cat /tmp/sysstat`
    fi
    
    /usr/sbin/sendmail -t << EOM
    Subject: Backup for ($host) Full.
    From: root@$host
    To: $email
    
    Backup Date: $bdate
    
    $chris
    
    System Files: 
    $sysis
    
    
    
    EOM
            $rm /tmp/mailstat.full
            if [ -f /tmp/sysstat ]; then
            $rm /tmp/sysstat
            fi
            fi
    chris=
    
            if [ -f /tmp/mailstat.diff ]; then
    chris=`$cat /tmp/mailstat.diff`
    if [ -f /tmp/sysstat ]; then
    sysis=`$cat /tmp/sysstat`
    fi
    
    /usr/sbin/sendmail -t << EOM
    Subject: Backup for ($host) Diffs.
    From: root@$host
    To: $email
    
    Backup Date: $bdate
    
    $chris
    
    System Files:
    $sysis
    
    EOM
            $rm /tmp/mailstat.diff
            if [ -f /tmp/sysstat ]; then
            $rm /tmp/sysstat
            fi
    
            fi
    chris=
    Simple mysql backup.
    Code:
    #!/bin/bash
    
    emailfrom=""
    email=""
    bdate=`date +%Y%m%d`
    donedate=`date +%m%d%Y`
    
    mysqluser=""
    mysqlpass=""
    mysqldump="/usr/sbin/mysqldump";
    
    dbfiles=(db1 db2 db3)
    
    echo "Creating db backups."
            cd /data/d
            count=${#dbfiles[@]}
            counts=0
    
            while [ "$count" -gt $counts ]
            do
            echo -n "db: ${dbfiles[$counts]}"
            /usr/local/bin/mysqldump -u $mysqluser -p$mysqlpass ${dbfiles[$counts]} > ${dbfiles[$counts]}.mysql.dump.$bdate
            zipit=`tar -cvf ${dbfiles[$counts]}.mysql.dump.$bdate.tar ${dbfiles[$counts]}.mysql.dump.$bdate`
            rm ${dbfiles[$counts]}.mysql.dump.$bdate
            echo " ...done"
            echo "db: ${dbfiles[$counts]}" >> /tmp/mailfile
            let counts=counts+1
            done
    
    rm /tmp/mailfile
    
            cd /data/
            cd db
            mv /data/d/* .

Posting Permissions

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