rsync in crontab fails with mkstemp: no such file or directory

I am running the following command in my backup script:

rsync -ravv user@serverprod:/home/user/sites/main_site/backup/*.zip /space/backup/main_site/

Crontab:

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
LC_ALL=en_US.UTF-8
LANG=en_US.UTF-8
* 20 * * 1-5 python /root/scripts/backup/backup.py -S -F main_site

I run into a issue every time rsync runs in crontab, but if I try to run it manually, I see no problem at all. I run as root in both cases.

Error:

rsync: mkstemp "/space/backup/main_site/.main_site_2016_01_29_132442250748_a82abb7e57f88c2afedb2e00c022f935c470b9e1_backup.zip.I3kVYl" failed: No such file or directory (2)

Now have in mind that main_site_2016_01_29_132442250748_a82abb7e57f88c2afedb2e00c022f935c470b9e1_backup is an expected file name. However, what comes before it, . and after .I3kVYl are not. I guess this must be temporary files the command creates in order to perform its operations. And the question is: why this error?

I am using Ubuntu server 14.04.4.

6

1 Answer

I had the similar issue when I tried to sync data with remote FTP server mounted using curlftpfs

Probably your /space/backup folder is also mounted remote folder

The solution worked for me:

  • create temp folder
  • indicate to rsync which temp folder to use (should be outside of remote destination folder)

    rsync -T "my_temp_folder_other_than_space/backup" -ravv user@serverprod:/home/user/sites/main_site/backup/*.zip /space/backup/main_site/

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like