Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Rsync cron job won't work no matter what

Featured Replies

Hey all,

 

I'm trying to automate a backup from one server to another via SSH - I've got this working (mostly) pretty nicely when I just paste my rsync command in terminal:

 

rsync -avz --delete -e "ssh -i /root/.ssh/TODD-rsync-key" [email protected]:/mnt/user/SoundDesign/ /mnt/user/SoundDesign/

 

However when I try to create a cron job for this it isn't running:

01 00 * * * rsync -avz --delete -e "ssh -i /root/.ssh/TODD-rsync-key" [email protected]:/mnt/user/SoundDesign/ /mnt/user/SoundDesign/

Its in a file called backupSoundDesign.cron in boot\config\plugins\cronjobs. The file was created from terminal.

I ran update_cron and also restarted etc but I'm still not seeing new files in the destination after I get back the next day. 

 

Any thoughts? I must be missing something simple I imagine.

 

Cheers
Harry

  • Community Expert

Have you checked whether the cron job is actually getting added to /etc/cron.d/root?   Also I think that when running under cron you need to specify the full path to rsync as you do not have the default environment set up to give you a search path.

 

i would have thought a better way to set this up would be via the User Scripts plugin?     That would handle setting it up in cron on your behalf.    It would also allow you to better test your script as you can try running it in foreground mode to check it is working as expected before scheduling it to run as a background job.

  • Author

Thank you so much for pointing me to this! I believe this solves the problem. I wasn't fully aware stuff needed to be added to /etc/cron.d/root. I've created a custom user script to run using the custom cron schedule. To check this should I just have a look in the /etc/cron.d/root directory?

 

Cheers

  • Community Expert
19 minutes ago, CrazyMaurice said:

Thank you so much for pointing me to this! I believe this solves the problem. I wasn't fully aware stuff needed to be added to /etc/cron.d/root. I've created a custom user script to run using the custom cron schedule. To check this should I just have a look in the /etc/cron.d/root directory?

 

Cheers

The technique you mentioned should have resulted in entries in /etc/cron.d/root (the update_cron script is an Unraid specific one intended for use by plugins to avoid them ever editing /etc/cron.d/root directly).

 

if you are doing it via the User Scripts plugin then it sorts out the cron issues on your behalf.

  • Author

This could have been the problem. I'm also wondering if there's a permissions error as it actually won't let me go in that directory anyway.

 

Hopefully the plugin has it all sorted though!

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.