Results 1 to 9 of 9

Thread: Need rsync back up script

  1. #1
    Join Date
    Feb 2013
    Beans
    3

    Question Need rsync back up script

    Hello There, I have two servers running Ubuntu 12.10. One is a back up server an the other is the main server where my website is hosted. I need a script that back's up the whole of the main server and mysql as it is a Wordpress blog to /home/user/backup on the back up server. it needs to use rsync an connect using ssh keys an also need's to be automatic every 30 min's using cron, Thanks minicomish.

  2. #2
    Join Date
    Jan 2009
    Location
    Nelspruit, South Africa
    Beans
    1,415
    Distro
    Ubuntu Development Release

    Re: Need rsync back up script

    me too
    Monitor: LG flatron w1954s 22", mobo: G31-m7 series, CPU: Intel LGA 775 Intel core duo 2 2,66GHZ, RAM: 3GB, GPU: ATI Radeom HD 2400, Storage: 500GB SATA and 80GB IDE, Windows 7 ultimate and Ubuntu

  3. #3
    Join Date
    Feb 2009
    Location
    Dallas, TX
    Beans
    7,790
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: Need rsync back up script

    Hi minicomish. Welcome to the forums!

    Is very difficult to offer specifics because you don't explain many details.

    Here are a few tips:
    • Install openssh-server on the backup server.
    • Set up a passwordless keys (read here).
    • rsync your files, but do not rsync your MySQL database.
    • Use internal MySQL replication to make copies of your database to the backup server.

    That should get you started. Let us know how it goes.
    Regards.

  4. #4
    Join Date
    Nov 2008
    Location
    Boston MetroWest
    Beans
    16,326

    Re: Need rsync back up script

    I'll add using mysqldump to create a plain-text backup of the database before running rsync.
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  5. #5
    Join Date
    Dec 2009
    Location
    germany
    Beans
    1,020
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Need rsync back up script

    Quote Originally Posted by papibe View Post
    Hi minicomish. Welcome to the forums!

    Is very difficult to offer specifics because you don't explain many details.

    Here are a few tips:
    • Install openssh-server on the backup server.
    • Set up a passwordless keys (read here).
    • rsync your files, but do not rsync your MySQL database.
    • Use internal MySQL replication to make copies of your database to the backup server.

    That should get you started. Let us know how it goes.
    Regards.
    hi
    i run this script years ago on solaris. but in ubuntu it don't work. (never change a running system).
    #-----------------------------------------------------------------#
    # agent is started on fist login once - or you'r remote
    # this agent is valid for all your primary login screens
    # make shure that your profile (eg. .profile, .ksh or .dterm will
    # be executed at login time - if not -> you are a loser (
    #-----------------------------------------------------------------#
    #
    # sometimes the shortest way is to take the negative way

    if [ ! `ps -u $LOGNAME | grep -c ssh-agent` ]
    then
    if [ -z "$SSH_CLIENT" ]
    then
    ssh-add </dev/null >/dev/null 2>&1
    r_c=$?
    [ $r_c -ne 0 ] && eval $(ssh-agent)
    fi
    fi

    # the agent will be killed if the session is finished - logout
    trap "kill $SSH_AGENT_PID >/dev/null 2>&1" 0

    i am every time (first time only) asked for my password. and even the unix default trap 0 (it's on the beginning of my .profile and .bashrc - i tried both - get no trap ?!)
    if ubuntu got a new feature - please tell me.
    it hassle me much - because i know !
    cheers
    "What is the robbing of a bank compared to the FOUNDING of a bank?" Berthold Brecht

  6. #6
    Join Date
    Feb 2013
    Beans
    3

    Re: Need rsync back up script

    Thanks for the replies everyone. I just need a basic rsync script to back my server up to a remote location an backup mysql, Ive looked all over the interwebs but there isn't a complete solution as im new to backing up using rsync but have been using ubuntu for about 5 years an i love it, Thanks minicomish.

  7. #7
    Join Date
    Jul 2009
    Location
    Austin, Texas, USA
    Beans
    435

    Re: Need rsync back up script

    My suggestion is that you install LuckyBackup.

    It provides a well designed GUI that makes it easy to select the folders that you want to backup and the target where you want to store the backed-up folders and their files. Also, LuckyBackup makes it easy to schedule your backups.

    I've used it for several years without any problems.
    Last edited by rewyllys; February 6th, 2013 at 04:56 PM.

  8. #8
    Join Date
    Jun 2009
    Location
    SW Forida
    Beans
    Hidden!
    Distro
    Kubuntu

    Re: Need rsync back up script

    Some general info:

    Rsync & Backup With Rsync and Ssh
    https://help.ubuntu.com/community/rsync
    https://help.ubuntu.com/community/CronHowto

    Originally Posted by MountainX View Post #20 also other backup apps
    http://ubuntuforums.org/showthread.p...ghlight=backup
    Sample rsync file, use a text editor and paste into a file & name it mybackup.sh

    Some folders to exclude from /home:
    http://ubuntuforums.org/showthread.php?t=1883834

    More detail on /etc files to backup - post #3:
    http://ubuntuforums.org/showthread.php?t=1500559

    Some more examples:
    http://rsync.samba.org/examples.html

    Backup to external with check of mounted & email
    http://ubuntuforums.org/showthread.php?t=1701292

    rsync confirmation list:
    http://ubuntuforums.org/showthread.php?t=1692800
    Check for mount of backup partition
    http://ubuntuforums.org/showthread.php?t=1701292
    #http://ubuntuforums.org/showthread.php?t=1555647&page=4
    more scripts:
    http://ubuntuforums.org/showthread.php?t=1319155
    UEFI boot install & repair info - Regularly Updated :
    https://ubuntuforums.org/showthread.php?t=2147295
    Please use Thread Tools above first post to change to [Solved] when/if answered completely.

  9. #9
    Join Date
    Feb 2013
    Beans
    3

    Re: Need rsync back up script

    Thanks for that, shall take a look

Tags for this Thread

Bookmarks

Posting Permissions

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