The below error was faced and tried for online answers, made my head to heat for couple of days and finally i was able to crack the solution for the below issue.
Please follow the below steps inorder to avoid the above error.
My script contains the below code.
The above script contains 2 echo commands and one rsync command. Just wanted to have timestamps before and after rsync command.
- Please use the steps to configure SSH keys in source and destination server.
- Give the full path of the rsync(/usr/bin/rsync) command in the script.
- Don't give the SOURCE directory with ssh command. Most of the blogs recommended to use the below syntax which didn't work for me.
/usr/bin/rsync -vv "ssh -i firstname.lastname@example.org:/tmp/compressed_logfiles/*.zip" /home/umasarath/archive
Placing my file in cron.
The above entry in cronjob was to run the transfer_files.sh on every Wednesday at 12AM.
When my script was executed via cron, there is no error message displayed in cron_alc.log and the script ran successfully without any issues.
Please try and explore yourselves. Kindly provide your feedback on this article.