0

I would like to run cron job that run rsync command to copy files from 3-4 days ago, I've already try some rsync command like this:

rsync -arogzv --ignore-existing --files-from=<(find . -type f,d -mtime +2 ) --exclude={'some_files'} /source /destination

but when my cron running, it says No MTA installed, discarding output. But, if I change the -mtime to -2, it's running but they copying file from 3 days ago until the newest files (for examples today)

I also try rsync command like this:

find /source -type f -mtime +2 -exec rsync -arogzv --ignore-existing --exclude={'some_files'} /source /destination \;

The result is same, it's copying file from 3 days ago until the newest files. What should I do? My goal is to copy files from 3 days ago and the older files, not the newest files.

  • The "No MTA installed, discarding output" message means it got errors on the job, but couldn't email them because it couldn't find a Mail Transfer Agent to send them via. You should log output and errors from the job (by adding something like `>>/tmp/cronjob.log 2>&1` to the cron entry), then examine that output for clues. – Gordon Davisson Jul 30 '22 at 17:49
  • I can see some error, but somehow it works now without error message "No MTA installed". But I still can't achieve my goals, It still sync until the newest file, I would like to sync older file to the oldest file, for example sync file from 31st to 30th July – Hidayat Taufik Aug 02 '22 at 03:09
  • What's the error in the log file? – Gordon Davisson Aug 02 '22 at 03:30
  • `rsync: link_stat "/source/.profile" failed: No such file or directory (2)` `rsync: link_stat "/source/.bashrc" failed: No such file or directory (2)` `rsync: link_stat "/source/.hushlogin" failed: No such file or directory (2)` `etc..` But after that error, it start syncing the file – Hidayat Taufik Aug 02 '22 at 03:43
  • So it sounds like there's something wrong with /source/.profile, .bashrc and .hushlogin etc. Are they unresolvable symbolic links? – Gordon Davisson Aug 02 '22 at 03:47
  • Yup, that files doesn't exist. – Hidayat Taufik Aug 02 '22 at 04:04

0 Answers0