Page 3 of 3 FirstFirst 123
Results 21 to 28 of 28

Thread: Web Server Backups

  1. #21
    Join Date
    Feb 2010
    Location
    QLD, Australia
    Beans
    479
    Distro
    Kubuntu 12.04 Precise Pangolin

    Re: Web Server Backups

    OK so I tried the script on the server last night and it came back with permission issues. An yes I made sure the perms on the share were open for writing, 777 in fact. But when I ran the script, rsync ran but came back with permission denied. When I check the perms again the backup folded used in the script still have the correct perms but the ones copied by rsync were
    drw - -
    I'm wondering if it's to do with the mounting of the samba share. I'm using the following command to mount the share;
    mount -t cifs //192.168.1.60/Backups /mnt/Backups -o user=****,password=*******
    Is there anything that anyone can see thats wrong? Its been a while since I've dealt with mounting samba shares via CLI.
    Ubuntu 12.04
    “To mess up a Linux box, you need to work at it; to mess up your Windows
    box, you just need to work on it”.
    TrinhamTechnologies.com.au

  2. #22
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    8,519
    Distro
    Kubuntu 14.04 Trusty Tahr

    Re: Web Server Backups

    What are the ownership and permissions on /mnt/Backup before the mount occurs? How about afterwards?

    I'd do everything as root, with /mnt/Backup owned by root:root with 755 permissions.

    However your original post said this was a CentOS server. Why are you using Samba? Rsync will copy files without having the remote server be mounted at all. If you do want to mount a share on a remote running Linux, use NFS. it will be faster, and all the *nix permissions will be preserved. If NFS seems daunting, then use sshfs. A quick Google search will bring up documentation for both these options.
    If you ask for help, 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

  3. #23
    Join Date
    Feb 2010
    Location
    QLD, Australia
    Beans
    479
    Distro
    Kubuntu 12.04 Precise Pangolin

    Re: Web Server Backups

    I went with samba because it's what I know best. I was thinking I sould go with one of those other methods. What would be best? nfs or sshfs?
    Ubuntu 12.04
    “To mess up a Linux box, you need to work at it; to mess up your Windows
    box, you just need to work on it”.
    TrinhamTechnologies.com.au

  4. #24
    Join Date
    Oct 2009
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Web Server Backups

    Go with NFS if you can handle it, otherwise just do sshfs.
    Come to #ubuntuforums! We have cookies! | Basic Ubuntu Security Guide

    Tomorrow's an illusion and yesterday's a dream, today is a solution...

  5. #25
    Join Date
    Nov 2007
    Location
    Newry, Northern Ireland
    Beans
    1,258

    Re: Web Server Backups

    I'd go for NFS too, here is the Ubuntu Community Documentation:

    https://help.ubuntu.com/community/SettingUpNFSHowTo

    Ask away if you have specific questions.
    Can't think of anything profound or witty.
    My Blog: http://gonzothegeek.blogspot.co.uk/

  6. #26
    Join Date
    Feb 2010
    Location
    QLD, Australia
    Beans
    479
    Distro
    Kubuntu 12.04 Precise Pangolin

    Re: Web Server Backups

    The following is the final copy that I have started running;
    Code:
    #! /bin/sh
    
    ## Things to do first
    
    
    # mount Share
    sudo mount -t nfs 192.168.1.60:/Backups /mnt/Backups
    
    
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    # VARIABLE PATHS
    
    
    DATE="`date +%d%m%Y`"
    ROOT="/mnt/Backups/UpdatingRootBackup"
    HOME="/mnt/Backups/UpdatingHomeBackup"
    ROOT_ARCH="/mnt/Backups/RootAchives/$DATE"
    HOME_ARCH="/mnt/Backups/HomeAchives/$DATE"
    SRC_ROOT="/"
    SRC_HOME="/home"
    LAST_ROOT="/mnt/Backups/LastRootUpdate"
    LAST_HOME="/mnt/Backups/LastHomeUpdate"
    ROOT_LOGS="/mnt/Backups/Logs/Root/$DATE.txt"
    HOME_LOGS="/mnt/Backups/Logs/Home/$DATE.txt"
    STALE=$(date +%Y%m%d --date='8 days ago')
    
    
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    
    
    #======================================================================================================
    # ROOT
    #Change Backup Dir Name.
    mv $LAST_ROOT $ROOT 
    
    
    #Back up the root drive.
    rdiff-backup --force --exclude=/proc --exclude=/lost+found --exclude=/mnt --exclude=/sys --exclude=/home --exclude=/media $SRC_ROOT $ROOT | cat > $ROOT_LOGS 
    
    
    #Archive the Root Update.
    tar -cvpjf  $ROOT_ARCH $ROOT
    
    
    #Change Update Dir Name
    mv $ROOT $LAST_ROOT
    
    
    #======================================================================================================
    # HOME
    
    
    #Change Backup Dir Name.
    mv $LAST_HOME $HOME 
    
    
    #Back up the home drive
    rdiff-backup --force $SRC_HOME $HOME | cat > $HOME_LOGS
    
    
    #Archive the Root Update.
    tar -cvpjf  $HOME_ARCH $HOME
    
    
    #Change Update Dir Name
    mv $HOME $LAST_HOME
    
    
    #======================================================================================================
    # Remove Old Backups
    
    
    rm /mnt/Backups/RootArchives/$STALE
    rm /mnt/Backups/HomeAchives/$STALE
    
    
    # unmount share 
    umount /mnt/Backups
    Can anyone see anything wrong with it? or are there going to be any issues to restore it any of it?
    Ubuntu 12.04
    “To mess up a Linux box, you need to work at it; to mess up your Windows
    box, you just need to work on it”.
    TrinhamTechnologies.com.au

  7. #27
    Join Date
    Oct 2009
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Web Server Backups

    Looks good. The only thing I'd change would be the capitalization of the variables. System variables are capitalized, but it isn't that big of a deal if the script works fine.

    See here:
    http://stackoverflow.com/questions/6...capitalization
    Come to #ubuntuforums! We have cookies! | Basic Ubuntu Security Guide

    Tomorrow's an illusion and yesterday's a dream, today is a solution...

  8. #28
    Join Date
    Feb 2010
    Location
    QLD, Australia
    Beans
    479
    Distro
    Kubuntu 12.04 Precise Pangolin

    Re: Web Server Backups

    Quote Originally Posted by CharlesA View Post
    Looks good. The only thing I'd change would be the capitalization of the variables. System variables are capitalized, but it isn't that big of a deal if the script works fine.

    See here:
    http://stackoverflow.com/questions/6...capitalization
    Thanks CharlesA, I'll keep that in mind. I have seen other script where people had used uppercase and thought that perhaps that was the proper way of doing it. Thanks for letting me know.
    Ubuntu 12.04
    “To mess up a Linux box, you need to work at it; to mess up your Windows
    box, you just need to work on it”.
    TrinhamTechnologies.com.au

Page 3 of 3 FirstFirst 123

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
  •