Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.
Western Digital Drives - The Preferred Drives of FreeNAS and TrueNAS CORE

RSync excludes work on command line but not when using cron task

Agent92

Junior Member
Joined
Feb 11, 2019
Messages
22
When I run the following command from the command lines as root everything works as it should, all the excluded directories are excluded:

Code:
/usr/local/bin/rsync --rsync-path="ionice -c 3 nice -n 12 rsync" -aS --delete-excluded --address='10.30.1.2' --log-file='/var/log/rsync.log' --exclude={/usr/share/cagefs-skeleton/*,dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/lost+found} remote.server:/ /mnt/local/backup/folder


But when I run it using a cron task I create in the FreeNAS interface suddenly my excludes doesn't work, it starts to copy for instance the content of /proc. I have chosen to run it as the root user when I created the cron task so I'm not sure what would be different that could cause this. Does anyone have any idea?

This is from the log when it starts to copy /proc.

Code:
2020/03/28 19:23:25 [4700] >f+++++++++ proc/buddyinfo
2020/03/28 19:23:25 [4700] >f+++++++++ proc/cgroups
2020/03/28 19:23:25 [4700] >f+++++++++ proc/cmdline
2020/03/28 19:23:25 [4700] >f+++++++++ proc/consoles


I know it says "proc" not "/proc" in the log but it did that when I ran it from the command line also.

I'm running FreeNAS 11.3-U1.
 

John Digital

Neophyte Sage
Joined
Jan 7, 2015
Messages
600
Hmm if it works from the cli try running the command from inside an executable bash script and use cron to call that instead of using cron to run the actual command.
 

Agent92

Junior Member
Joined
Feb 11, 2019
Messages
22
Did some more testing. Turns out it work when you exclude each directory individually, for example --exclude='/dev/*', but using the --exclude={} expression is just ignored when using a cron job. Seems like a bug?
 
Top