Rsync command to/from CIFS share does not work in cron, works in terminal?
Hi guys
I've got the following rsync command to sync files to and from CIFS shares hosted on a Windows 8 box: To rsync from a CIFS share on Windows 8, in the term, I do Code:
/usr/bin/rsync -avz --progress --no-whole-file /mnt/remote_software/* /home/earth/software/. Code:
/usr/bin/rsync -avz --progress --no-whole-file /home/earth/software/* /mnt/remote_software/. Code:
mount -t cifs //192.168.1.1/software /mnt/remote_software -o username=myname,password=mypass However, as soon as I try to touch this share from an rsync-spawned cron, rsync does not work. My crontab looks like this: Code:
30 00 * * * sh -f /root/do_backup.sh > errors.txt 2>&1 Code:
/usr/bin/rsync -avz --progress --no-whole-file /mnt/remote_software/* /home/earth/software/. E. g. the command I pass from the cron calls do_backup.sh - if I do Code:
sh -f /root/do_backup.sh If cron calls sh -f /root/do_backup.sh rsync cannot see the /mnt/remote_software CIFS share, and the rsync fails. Errors.txt then contains Code:
sending incremental file list When in the terminal, I run the manual rsync command while logged in as root. I'm on Centos 6 Any ideas as to why stuff spawned in cron (running as root, correct?) cannot see CIFS shares? To test I also put a df -mh > mounts.txt into the crontab a minute before the rsync script's start, and mounts.txt clearly contains Code:
//192.168.1.1/software/ 1.9T 1.3T 601G 68% /mnt/remote/software Any ideas what is going on and how to fix it? Thanks! |
I think the problem is the wildcard '*', it is read literally.
To test that, remove the '*' and add a directory instead. |
Hi
Thanks of the reply! Ok I'll try to remove the trailing * and . and see what happens... Thanks again |
That was the solution! I removed the * as trailing character for the source rsync specification and removed . as trailing character in the rsync target specification.
The rsync job now runs fine if triggered from cron. Thanks for the help! |
All times are GMT -5. The time now is 09:29 PM. |