AWS S3 backup via cronjob failing on Scaleway- No such file or directory

Hi,

I am not even sure if this is an issue related to ERPNext, (which I guess, its not), and should it be raised here at all? But, I am raising this here as I think that probably someone might have tackled this issue, and might be able to give some insight and help.

I have created a backup.sh file on Scaleway server, where the default home directory is /root. When I run the backup.sh file manually, the backup is going through. But, when I am running it through crontab, like:

20 0 * * * cd /home/frappe/frappe-bench && /bin/bash /home/frappe/frappe-bench/backup.sh >> /home/frappe/frappe-bench/logs/aws-backup.log 2>&1

It is giving an issue of:

New S3 backup folder: 31082017_123717.
DB File: 20170831_123703_fda97bf0_database.sql.gz
Files: /home/frappe/frappe-bench/sites/site1.local/private/backups/20170831_123703_fda97bf0_files.tar
Private Files: /home/frappe/frappe-bench/sites/site1.local/private/backups/20170831_123703_fda97bf0_private_files.tar
move failed: sites/site1.local/private/backups/20170831_123703_fda97bf0_database.sql.gz to s3://testserver-backups/test-bucket/31082017_123717/20170831_123703_fda97bf0_database.sql.gz [Errno 2] No such file or directory: ‘/home/frappe/frappe-bench/sites/site1.local/private/backups/20170831_123703_fda97bf0_database.sql.gz’

Any idea what could be the possible reason? Earlier, I was getting an “Unable to locate credentials” error, which I tried to resolve by putting the AWS_ACCESS_KEY_ID inside the script itself, and am no longer getting that error.

Any kind of suggestions or help will be appreciated. Thanks in advance.

Please list the contents of this script UmaG

Thanks for the response @clarkej.

My script was taking the backup and then moving the file to the AWS. And, looks like the next command of moving the file was happening before the backup could be completed. So, there was a “file not found” error. I have resolved the issue by moving the backup command out of the script. And, it seems to work now.

Please close the issue.
Thanks
Uma