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 not working

Featured Replies

So for the past week I have spent hours trying to troubleshoot this problem. I initially used User Scripts plugin to create a cron job that would backup some shares to a remote server. I eventually noticed once the script was run via User Scripts my local servers webGUI would be completely unresponsive. At first I thought something had crashed and would end up performing a unclean shutdown. Being that I am trying to backup large files over the internet, I would sometimes not be able to access the webGUI for a whole day. When I had the servers on the same LAN I did not have this issue at all since file transfers occurred much quicker.

 

Now seeking out an alternative method to run the cronjob I created a crontab in /boot/config/plugins/dynamix. The crontab has the following:

0 12 * * 7 rsync -a --ignore-existing --ignore-errors --delete --log-file=/mnt/cache/appdata/rsync.log /mnt/user/audiobooks/ /mnt/disks/192.168.1.150_audiobooks |& logger

However the job does not occur and the syslog shows:

 

Aug 29 22:26:40 UNRAID root: ./audiobooks.cron: line 1: 0: command not found.

 

The strange thing is before using User Scripts I performed my rsync jobs this way and it worked fine. I can even manually run this rsync job via shell and it works perfectly fine. What is happening here? Is my syntax incorrect? I don't have anything else in the crontab so I am unsure why this is an issue now. Any help is appreciated!

unraid-diagnostics-20170829-2227.zip

Edited by osker246

  • Community Expert

Try using the full path for rsync:

/usr/bin/rsync

  • Author
8 hours ago, johnnie.black said:

Try using the full path for rsync:

/usr/bin/rsync

Thanks for the response! I'm assuming by full path that I should do:

 

0 12 * * 7 /usr/bin/rsync -a --ignore-existing --ignore-errors --delete --log-file=/mnt/cache/appdata/rsync.log /mnt/user/audiobooks/ /mnt/disks/192.168.1.150_audiobooks |& logger

Correct? If so, the same issue of command not found occurred. 

With what editor did you create the cron file?

Sent from my LG-D852 using Tapatalk

  • Author

I did it in nano, via putty. 

  • Author

Well I'm a complete idiot and everything works as it should. I was under the impression that I could manually run cron tab by entering the path of the crontab in the command prompt. Turns out this is not the case. Sorry to waste your time.

2 minutes ago, osker246 said:

Well I'm a complete idiot and everything works as it should. I was under the impression that I could manually run cron tab by entering the path of the crontab in the command prompt. Turns out this is not the case. Sorry to waste your time.

To add the cron job, place the file into /boot/config/plugins/WhateverName/nameoffile.cron

 

Then reboot or run update_cron

  • Author
1 minute ago, Squid said:

To add the cron job, place the file into /boot/config/plugins/WhateverName/nameoffile.cron

 

Then reboot or run update_cron

 Yeah, that's what I have been doing. I was just under the impression that I could manually execute the cron job in the command prompt for testing purposes. So when I would enter the path to the crontab in the command prompt, it would give the error. I just realized it was working properly when one of my crontab's executed perfectly fine. Thanks for the help though!

  • 1 year later...

@Squid

I have a cron question...about a week ago I found some post and added an rsync command somewhere and its now showing in /etc/crond/ under root
in there the top line is somethign i remember adding just not sure from where

# Perform a daily backup of my Dockers, USB's and VM's at 3:00am
00 3 * * * rsync -aE --delete /mnt/disks/Thor_Backup/ /mnt/user0/Backup/ |& logger

 

 

if i delete the line, save the file and run cron_update that line is back again, i have tried creating a new one for 7am on the config/plugins folder

 

i called it mycron/Thor2Sif.cron and have the same cron schedule but for 7am where i want it to run

i ran some tests setting it for 5 min ahead of current time to see if it would run and it wont. not seeing any logs though as not sure where to look

 

3 hours ago, Can0nfan said:

mycron/Thor2Sif.cron

The .cron file has to be stored in a folder of a plugin since 6.5.x  Easiest place to put it is in the dynamix folder

3 hours ago, Squid said:

The .cron file has to be stored in a folder of a plugin since 6.5.x  Easiest place to put it is in the dynamix folder

yeah so the full path i have it in is /boot/config/plugins/mycron/Thor2Sif.croon

 

that the way i understood you mentioned to place it.

 

I did check the dynamix folder and see the newly modified one (i changed start time in a few places to see where the dron.d/root.cron was syncing from on a update_cron command

You can't put it Into the mycron folder. It has to be within a installed plugin's folder

Sent from my LG-D852 using Tapatalk

15 minutes ago, Squid said:

You can't put it Into the mycron folder. It has to be within a installed plugin's folder

Correct. There is a security policy in place which doesn't allow to start any arbitrary cron job.

Only when a cron job is placed under an installed plugin folder or the default plugins/dynamix folder, it is allowed to run.

ok to put it clearly i should move my Thor2Sif.cron from the plugins/mycron folder to plugins/dynamix/Thor2Sif.cron ???

 

i am curious where the root in /etc/cron.d/ is getting the cron job then when i run update_cron


# Run daily cron jobs at 4:40 every day:
40 4 * * * /usr/bin/run-parts /etc/cron.daily 1> /dev/null

# Perform a daily backup of my Dockers, USB's and VM's at 7:00am
00 7 * * * rsync -aE --delete /mnt/disks/Thor_Backup/ /mnt/user0/Backup/

#
# Run weekly cron jobs at 4:30 on the first day of the week:
30 4 * * 0 /usr/bin/run-parts /etc/cron.weekly 1> /dev/null
#
# Run monthly cron jobs at 4:20 on the first day of the month:
20 4 1 * * /usr/bin/run-parts /etc/cron.monthly 1> /dev/null
0 10 * * 1 /usr/local/emhttp/plugins/ca.backup2/scripts/backup.php &>/dev/null 2>&1
root@Sif:/# crontab -l
# If you don't want the output of a cron job mailed to you, you have to direct
# any output to /dev/null.  We'll do this here since these jobs should run
# properly on a newly installed system.  If a script fails, run-parts will
# mail a notice to root.
#
# Run the hourly, daily, weekly, and monthly cron jobs.
# Jobs that need different timing may be entered into the crontab as before,
# but most really don't need greater granularity than this.  If the exact
# times of the hourly, daily, weekly, and monthly cron jobs do not suit your
# needs, feel free to adjust them.
#
# Run hourly cron jobs at 47 minutes after the hour:
47 * * * * /usr/bin/run-parts /etc/cron.hourly 1> /dev/null
#
# Run daily cron jobs at 4:40 every day:
40 4 * * * /usr/bin/run-parts /etc/cron.daily 1> /dev/null
# Perform a daily backup of my Dockers, USB's and VM's at 7:00am
00 7 * * * rsync -aE --delete /mnt/disks/Thor_Backup/ /mnt/user0/Backup/
#
# Run weekly cron jobs at 4:30 on the first day of the week:
30 4 * * 0 /usr/bin/run-parts /etc/cron.weekly 1> /dev/null
#
# Run monthly cron jobs at 4:20 on the first day of the month:
20 4 1 * * /usr/bin/run-parts /etc/cron.monthly 1> /dev/null
0 10 * * 1 /usr/local/emhttp/plugins/ca.backup2/scripts/backup.php &>/dev/null 2>&1

I think i answered my own question.....i have a dailybackup.cron already in the dynamix folder and my newer thor2sif.cron moved there...when i run an update_cron it puts both entries into crontab....I will delete my thor2sif one and run with the existing one

thanks for the helping hand..

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.