Results 1 to 7 of 7
  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
    3,290
    Level
    23
    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
    3,290
    Level
    23
    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
    3,290
    Level
    23
    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/

Posting Permissions

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