Results 1 to 10 of 10
  1. #1
    SagoJonB Guest

    Remote backup script

    Hi all,

    Just finished a little script that works nicely for me, and thought it might be useful for others. Pretty basic stuff, but for those who aren't doing any backups, there's no excuse not to!

    Run script as iworx user or add to iworx user crontab. Make sure script is executable, and also be sure iworx owns recursively and has permission to write to /home/interworx/backups/* and also owns /home/interworx/yourkeyfile (also keyfile should be chmodded 400 usually)
    ** This script assumes you've set up keypairs for your remote destination!

    I echo space remaining on remote destination to the log because there is only a 10G root device on my remote destination...
    <<-----------------------------------CUT--------------------------------------------------->>
    [root@web ~]# cat /home/interworx/backup-script
    #!/bin/bash
    backup_date=`date +%b%d%y`

    #create local backup folder for this backup session
    mkdir /home/interworx/backups/$backup_date

    #create the logfile for this backup session
    echo -e "Starting full Siteworx backups locally...\n" > /home/interworx/backups/logs/$backup_date.log

    #start full Siteworx local backups
    /home/interworx/bin/backup.pex --domains all --output-dir /home/interworx/backups/$backup_date >> /home/interworx/backups/logs/$backup_date.log

    echo -e "\nStarting rsync of Siteworx backups to remote destination...\n" >> /home/interworx/backups/logs/$backup_date.log

    #rsync to remote destination
    rsync -avz -e "ssh -i /home/interworx/yourkeyfile" /home/interworx/backups/$backup_date user@host:folder >> /home/interworx/backups/logs/$backup_date.log

    echo -e "\nVerify data at remote destination...\n" >> /home/interworx/backups/logs/$backup_date.log

    #verify data at remote destination
    ssh -i /home/interworx/yourkeyfile user@host "ls -ahls ~/folder/$backup_date; echo -e '\n'; du -sh ~/folder/$backup_date/*; echo -e '\nSpace remaining on remote destination root device...\n'; df -h" >> /home/interworx/backups/logs/$backup_date.log

    #mail full log
    mail -s "Siteworx remote backup report: $backup_date" email@address.com < /home/interworx/backups/logs/$backup_date.log
    <<----------------------------CUT--------------------------------------------------->>

    Any thoughts or comments are welcomed

    Jon

  2. #2
    Join Date
    Jul 2011
    Location
    Sweden
    Posts
    150
    Points
    5,248
    Level
    30
    what parts of the server does this script backup?

  3. #3
    Join Date
    Aug 2010
    Location
    Pittsburgh, PA
    Posts
    166
    Points
    2,220
    Level
    19
    It looks like it's just backing up all siteworx accounts and then rsyncing them to a remote server.
    Daniel Motles
    Technical Support
    InterWorx-CP | http://interworx.com/

  4. #4
    Join Date
    Jul 2011
    Location
    Sweden
    Posts
    150
    Points
    5,248
    Level
    30
    ok .. i would have loved it to take the mysql dbs as well

    the best would be if there was a s3 backup module for nodeworx. Something else then the R1soft module.

  5. #5
    Join Date
    Aug 2010
    Location
    Pittsburgh, PA
    Posts
    166
    Points
    2,220
    Level
    19
    Evanion,

    The siteworx backup would also include the mysql databases of the siteworx accounts. Or do you mean the interworx database?
    Daniel Motles
    Technical Support
    InterWorx-CP | http://interworx.com/

  6. #6
    Join Date
    Jul 2011
    Location
    Sweden
    Posts
    150
    Points
    5,248
    Level
    30
    I would love both actually ...

  7. #7
    Join Date
    Aug 2010
    Location
    Pittsburgh, PA
    Posts
    166
    Points
    2,220
    Level
    19
    You can get snapshot backups of the interworx database in:
    /home/interworx/var/backups/iworxdb/
    Daniel Motles
    Technical Support
    InterWorx-CP | http://interworx.com/

  8. #8
    Join Date
    Nov 2014
    Location
    Minneapolis, mn
    Posts
    9
    Points
    709
    Level
    10
    Umm what I was looking for granted I wonder if the command line is still the same as today.
    So youíre a little weird? Work it! Different? Own it! Better to be a nerd than one of the herd!
    óMandy Hale

  9. #9
    Join Date
    Apr 2012
    Posts
    1,805
    Points
    14,968
    Level
    53
    Hi mrgeekchris

    I would expect the CLI still to work for centos versions upto and including 6.

    Centos 7 onwards may not work as expected

    I hope that helps a little

    Many thanks

    John

  10. #10
    Join Date
    Mar 2014
    Posts
    63
    Points
    1,729
    Level
    16
    This is a good post & thx for the script but checkout my kung fu: http://forums.interworx.com/threads/...-For-Interworx

Posting Permissions

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