0

Sorry if this is long, I wanted to get as much information in as possible. I am running an odroid c2 with Ubuntu MATE 18.04.3 as a home NAS with two 6TB drives. I have been trying to mirror them using rsync in crontab everyday at 5am. I have looked at all of the similar questions regarding this issue, but none of the solutions seem to have worked for me.

I originally entered "sudo crontab -e" and used the command:
"0 5 * * * rsync -av --delete /media/USBHDD1/shares /media/USBHDD2/shares/".
This did not work in crontab but works flawlessly when entered on the command line.

After much research online and trying many things, it has evolved into me navigating to the system-wide /etc/crontab and trying the slightly differing command:
"0 5 * * * /usr/bin/rsync -av --delete /media/USBHDD1/shares/ /media/USBHDD2/shares/"

My files are still not backing up automatically to the second drive and I am at a loss at what to try next. Does anybody have any ideas?

Thank you.

Edit:

Running "sudo which rsync":

odroid@odroid:/etc$ sudo which rsync
/usr/bin/rsync

  • How do I format my code blocks? – Cyrus Sep 1 '19 at 16:31
  • Add output of sudo which rsync to your question. – Cyrus Sep 1 '19 at 16:33
  • 1
    Are /media/USBHDD1/ and /media/USBHDD2 mounted traditionally (using /etc/fstab) or do they rely on automounting via a user's desktop session? – steeldriver Sep 1 '19 at 16:35
  • /media/USBHDD1/ and /media/USBHDD2 are being mounted at startup using /etc/fstab. – Jared Sep 1 '19 at 20:44
0

If you're using the system-wide crontab, you need to specify the user to be used for executing the command.

If this still doesn't solve the problem, remember that crontab file needs to end with an empty line.

  • Both of them seem to end in an empty line. I don't have a preference on which crontab to use, I was just trying both to hopefully get one or the other working. When modifying the system-wide crontab, would I simply add "root" before "/usr/bin/rsync" in the rsync command? – Jared Sep 1 '19 at 20:48
  • You said the command works from the command line. I suppose you run this as odroid then. So this should be the username to add to crontab before the command. – Florian Schwalm Sep 2 '19 at 8:43
  • Adding "odroid" before the rsync command seems to have solved the problem for me. Running iotop now shows disk activity from rsync, and the files seem to be appearing onto the second drive finally. Thank you very much for the help! – Jared Sep 2 '19 at 19:01

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.