I need to copy a backup file to a backup server everyday. I am using PublicKey SSH authentication.
All of the things work but not together:
If I run this line in crontab
rsync /home/ubuntu/*date_backup.archive* ssh centos@10.x.x.x/home/centos/backupThis works and sends the backup correctly
But since the date in the filename of the .archive changes, I need to run a script. Then I create rsync_backup.sh
#!/bin/bash
date= ...
rsync /home/ubuntu/*date_backup.archive* ssh centos@10.x.x.x/home/centos/backupThen, if I run this via terminal with bash rsync_backup.sh, it works and sends the backup correctly
BUT if I put
* * * * * bash /home/ubuntu/rsync_backup.shor
* * * * * bash /home/ubuntu/rsync_backup.shThe backup doesn't reach the destination host.
Also, if I put in the script another test line on local (mkdir /home/centos/test) and launch with crontab, it works!
I tried also with SCP, still the same results!
Do you have some ideas? Source machine is Ubuntu and Destination is Centos
Many thanks in advance
2 Reset to default