L
L
Leonid2016-11-11 10:36:49
Backup
Leonid, 2016-11-11 10:36:49

Backup server files on the server using tar, ftp - which is better?

There is a backup of folders and files from the Primary server to the Backup .
On the main server , the .sh file launched by CRON looks like this:

tar -zcvf $DIR/home.tar.gz --listed-incremental=$DIR/home_meta . --exclude-vcs --exclude="./backup" --exclude="./tmp" --exclude="./assets" --exclude=".htaccess"
cd $DIR
ftp -n $FTPS <<EOF
user $FTPU $FTPP
put home.tar.gz
quit
EOF
rm -f home.tar.gz

On the Backup server .sh is like this:
cd $DIR
tar -zxvpf home.tar.gz -C $HOME
rm -f home.tar.gz

The main task: to maintain a fully functional version of the site on the Standby server and update the data 1 time in essence. I do not describe database synchronization here.
Basically everything works except:
  1. If a new folder is created on the Primary server with some non-default CHMOD rights, then when copying it on the Backup server, this folder no longer receives such CHMOD settings, although the p flag in "tar -zxv p f" is set for me, or is that not it?
  2. Probably a banal question, but how to make tar -zxv unpack files and folders and have a specific user on the backup server as their owner? Is the .sh file supposed to be run by that user initially, or is it optional?
  3. Sometimes when creating an archive on the Core Server, I get messages like:
    tar: .: Directory has been renamed
    tar: ./crop: Directory has been renamed
    tar: ./files: Directory has been renamed
    What the hell? After all, the home_meta file remains unchanged, the directories and files themselves on the Main server also do not change.

ps: Maybe you solved a similar problem somehow differently - it would be interesting to hear...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
CityCat4, 2016-11-11
@CityCat4

3. If there is enough space, then it is better to first make a copy of the data side by side, and only then pack the copy in order to avoid the situation that while the packing was in progress, the data has changed. Then delete the copy.
It's better to copy something over ssh - scp, sftp... so as not to tempt kakers.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question