A
A
AnonDanon2020-06-05 09:14:51
Backup
AnonDanon, 2020-06-05 09:14:51

Rsync script for noob?

Greetings. I have a small script that backs up files from one VPS directory to another VPS about the crown:

#!/bin/sh
rsync -e 'ssh -p 22' -avzp /usr/www REMOTE_HOST_IP:/home/user/backups


Accordingly, every night my daddy /home/user/backups/www is overwritten on the second vpsk.

What lines should be added to the script so that the daddy is not overwritten, but simply added a new one? For example:
www_05_05_2020_02:00:00
www_06_05_2020_02:00:00
www_07_05_2020_02:00:00

I saw an example of one script, tried to substitute the necessary lines in mine, but nothing happened, due to my neediness, apparently and misunderstanding of the processes
#!/bin/bash
### FTP login credentials below ###
FTPU="FTP-Username"
FTPP="FTP-Password"
FTPS="FTP-IP-Address"

<b>NOW=$(date +"%d-%m-%Y")</b>

### local directory to backup ###
FILE="/DIR-to-Backup"

### Login to remote server ###
### No need to edit any of the fields below ###
### Default DIR is backup ###
lftp -u $FTPU,$FTPP -e "cd backup;mkdir $NOW;cd $NOW;mirror -R $FILE /backup/$NOW;quit" $FTPS

I would be very grateful for help

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
pfg21, 2020-06-05
@pfg21

put syncthing and forget about rsync.
plus, on a machine with a copy, configure https://docs.syncthing.net/users/versioning.html
will work by itself, by the daemon. the number of participants in the balls is not limited.

S
Sergey Pankov, 2020-06-05
@trapwalker

And you don’t touch rsync, but just also on schedule, but with a shift by half the synchronization interval, start archiving the old folder without deleting the original . Rsync doesn't just copy files, it does it efficiently by only transferring what has changed.
For your case, it is most efficient to make an incremental backup, then...
Wait, this is a completely new idea! Surely no one else in the world has thought of doing incremental backups with rsync!
Looks like you're the first person in the galaxy to need this.
I even went to Google and checked with the request " rsync incremental backup ".
And you know what?
It turns out there are a lot of articles about it !
I don't even know...weird...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question