Transfer & sync files in a directory to remote node using crontab & rsync
openssh server
rsync
crontab
for testing type
you need to provide remote server credentials, if this is working you can automate this using a bash file and add it to crontab, create script and type below code.
I have placed above script in /root/backup.sh, you can make it executable using
now create ssh key using this command from source node.
once it is created, use this command to push key to destination node.
for security in type these commands in destination node.
now edit crontab in first node
this is open crontab in default editor, eg nano or vi. now type the
by now it will start working, if you want to see the cron logs, you can check using
Last updated
Was this helpful?