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.

[SOLVED] Custom crontab keeps reverting to default

Featured Replies

I added a couple of lines in my crontab to automatically backup some of my files using rsnapshot. It works pretty well and when I reboot I can see that my modified crontab is automatically loaded. I noticed that sometimes the crontab reverts to the default one (and without rebooting the machine). I think it has to do with stopping or starting the array or modifying user share settings. This is really annoying because after few weeks I discover that no backup has been performed. What script resets the crontab when array is stopped or started? Should I put my crontab tweak at a better location rather than /boot/config/go?

 

/boot/config/go

...
# Install/configure rsnapshot
/boot/config/myconfig/rsnapshot-setup.sh

 

/boot/config/myconfig/rsnapshot-setup.sh

#!/bin/sh
installpkg /boot/packages/rsnapshot-1.3.1-i486-1af.tgz
cp /boot/config/myconfig/rsnapshot.conf /etc/
crontab -l >/tmp/crontab
echo "# start rsnapshot periodicaly" >>/tmp/crontab
echo "15 05 * * * /usr/bin/rsnapshot daily" >>/tmp/crontab
echo "10 02 * * 01 /usr/bin/rsnapshot weekly" >>/tmp/crontab
echo "05 00 01 * * /usr/bin/rsnapshot monthly" >>/tmp/crontab
crontab /tmp/crontab

I added a couple of lines in my crontab to automatically backup some of my files using rsnapshot. It works pretty well and when I reboot I can see that my modified crontab is automatically loaded. I noticed that sometimes the crontab reverts to the default one (and without rebooting the machine). I think it has to do with stopping or starting the array or modifying user share settings. This is really annoying because after few weeks I discover that no backup has been performed. What script resets the crontab when array is stopped or started? Should I put my crontab tweak at a better location rather than /boot/config/go?

 

/boot/config/go

...
# Install/configure rsnapshot
/boot/config/myconfig/rsnapshot-setup.sh

 

/boot/config/myconfig/rsnapshot-setup.sh

#!/bin/sh
installpkg /boot/packages/rsnapshot-1.3.1-i486-1af.tgz
cp /boot/config/myconfig/rsnapshot.conf /etc/
crontab -l >/tmp/crontab
echo "# start rsnapshot periodicaly" >>/tmp/crontab
echo "15 05 * * * /usr/bin/rsnapshot daily" >>/tmp/crontab
echo "10 02 * * 01 /usr/bin/rsnapshot weekly" >>/tmp/crontab
echo "05 00 01 * * /usr/bin/rsnapshot monthly" >>/tmp/crontab
crontab /tmp/crontab

the unRAID web-interface uses its own copy of the "cron" file. It does not extract one from the crontab command each time it makes a change.

 

It is easy though to fix. All you need is to add one more line to your rsnapshot-setup.sh script. 

That line is shown below.  (The last character on the line is a "-" )

 

#!/bin/sh

installpkg /boot/packages/rsnapshot-1.3.1-i486-1af.tgz

cp /boot/config/myconfig/rsnapshot.conf /etc/

crontab -l >/tmp/crontab

echo "# start rsnapshot periodicaly" >>/tmp/crontab

echo "15 05 * * * /usr/bin/rsnapshot daily" >>/tmp/crontab

echo "10 02 * * 01 /usr/bin/rsnapshot weekly" >>/tmp/crontab

echo "05 00 01 * * /usr/bin/rsnapshot monthly" >>/tmp/crontab

crontab /tmp/crontab

cp /tmp/crontab /var/spool/cron/crontabs/root-

 

When unRAID next makes a change to cron, it starts with the copy in "/var/spool/cron/crontabs/root-" rather than use the crontab command to get the starting point.

 

Edit: On unRAID 5.X releases, unRAID no longer uses root-, and following the above suggestion will result in warnings in the syslog of a non-existant user root-.  In other words, do not follow the hint in this post. 

 

Joe L.

 

  • Author

Thanks for the quick answer. This is great information.

  • 1 year later...

Thanks Joe... just want I need too.

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.