1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

One line: scp mysqldump db and xf data

Discussion in 'Server Configuration and Hosting' started by Marcus, Sep 7, 2013.

  1. Marcus

    Marcus Well-Known Member

    How can I scp both xf's compressed database and data folders in one line for my daily cron job?

    I bet I am not the only one moving daily backups to an external server.
  2. Floren

    Floren Well-Known Member

    rsync is better. Why do you need to do it in one line?
    If you want, you can create a shell script with 3000 lines and call it in a /etc/cron.d/backup cron file.
  3. Marcus

    Marcus Well-Known Member

    I love smaller code, for me it's more elegant. I can already scp, dump my db, compress, and name it to yyyy-mm-dd in one line. Just curious how to add gzipped data folders to it.

    What is the advantage of rsync? Is it preinstalles in minified CentOS 6?
  4. Tracy Perry

    Tracy Perry Well-Known Member

    Direct from rsyncs support page:
    rsync is an open source utility that provides fast incremental file transfer. rsync is freely available under the GNU General Public License and is currently being maintained by Wayne Davison.

    Basically you don't transfer everything but one time. After that, only changed files will be transferred.

    To transfer from one of my Forums to my Mac
    #! /bin/bash
    cd /Users/tracy
    rsync -avz -e ssh username@yourdomain.com:/var/www/forum ~/website
    rsync -avz -e ssh username@yourdomain.com:/db_backup ~/website
    where the first /db_backup is where mydumper dumps my DB, and /var/ww/forum is the forum, they get transferred to a local directory in my home called website.
    Last edited: Sep 7, 2013
  5. Marcus

    Marcus Well-Known Member

  6. 0ptima

    0ptima Well-Known Member

    As others have mentioned, you should look into rsync.
  7. AndyB

    AndyB Well-Known Member

    As others said, use rsync. You don't gain anything by compressing images.
  8. Floren

    Floren Well-Known Member

    One liners tend to be cumbersome over 80 chars. Personally, I like to use always a shell script where I can write as many lines I like and document inside complex procedures.
    0ptima likes this.

Share This Page