crontab -e
Then add this:
0 20 * * * /<script_path>/copy_remote_backups.sh
Explanation: run script at 20:00 every day
crontab -e
Then add this:
0 20 * * * /<script_path>/copy_remote_backups.sh
Explanation: run script at 20:00 every day
/backups/*$(date -d "yesterday" +%F)*.gz specify files at remote server in /backups/ directory that have yyyy-mm-dd in its' names and .gz extension
I set it to yesterday to be sure they exist. Depends on your backup files naming.
/backups/*$(date -d "yesterday" +%F)*.gz specify files at remote server in /backups/ directory that have yyyy-mm-dd in its' names and .gz extension
I set it to yesterday to be sure they exist. Depends on your backup files naming.
6) Create script /<script_path>/copy_remote_backups.sh:
scp -i /<local_dir>/backupuser backupuser@<remote_ip>:/backups/*$(date -d "yesterday" +%F)*.gz /backups/
6) Create script /<script_path>/copy_remote_backups.sh:
scp -i /<local_dir>/backupuser backupuser@<remote_ip>:/backups/*$(date -d "yesterday" +%F)*.gz /backups/
chmod 700 /<local_dir>/backupuser
chmod 700 /<local_dir>/backupuser
AuthorizedKeysFile /etc/ssh/keys/backupuser.pub
AllowUsers backupuser
AuthenticationMethods publickey
PermitTTY no
PermitUserRC no
X11Forwarding no
AllowTcpForwarding no
GatewayPorts no
PermitTunnel no
AuthorizedKeysFile /etc/ssh/keys/backupuser.pub
AllowUsers backupuser
AuthenticationMethods publickey
PermitTTY no
PermitUserRC no
X11Forwarding no
AllowTcpForwarding no
GatewayPorts no
PermitTunnel no
(config text in the next comment)
(config text in the next comment)