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.

cron each minute or two?

Featured Replies

Stupid question but what is the best way to insert a line to crontab from /boot/config/go script? I need to put a script to run each minute or two (for controlling fan speed) and /etc/cron.hourly is just too long.

 

Thanks!

 

# need the following to go to crontab from /boot/config/go

*/2 * * * * /boot/scripts/unraid-fan-speed.sh 1>/dev/null 2>&1

Stupid question but what is the best way to insert a line to crontab from /boot/config/go script? I need to put a script to run each minute or two (for controlling fan speed) and /etc/cron.hourly is just too long.

 

Thanks!

 

# need the following to go to crontab from /boot/config/go

*/2 * * * * /boot/scripts/unraid-fan-speed.sh 1>/dev/null 2>&1

 

I'd do it like this:

chmod +x /usr/local/bin/unraid-fan-speed.sh

crontab -l >/tmp/crontab

grep -q "unraid-fan-speed.sh" /tmp/crontab 1>/dev/null 2>&1

if [ "$?" = "1" ]

then

    crontab -l | egrep -v "control unRAID fan speed based on temperature:|unraid-fan-speed.sh" >/tmp/crontab

    echo "# control unRAID fan speed based on temperature:" >>/tmp/crontab

    echo "*/2 * * * * /usr/local/sbin/unraid-fan-speed.sh 1>/dev/null 2>&1" >>/tmp/crontab

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

    crontab /tmp/crontab

fi

In addition to adding the line to the new crontab, You must copy the new crontab file to /var/spool/cron/crontabs/root-  (with a trailing "dash" on the end)

since unRAID'd emhttp does not re-read the crontab if you make changes.  It uses the file for its next starting point.

  • Author

Joe, thanks. Is it any good to copy directly a saved version of crontab to /var/spool/cron/crontabs/root and root-

I don't think it's good form to just use a saved static copy of a file that by it's nature should be dynamic.

 

With that said, on a rarely used environment you could likely get by without issue. Likewise in the future, if anything would change on the base unRAID distro or a new addon uses it, you might be spending time troubleshooting why something doesn't work unless you remember to double-check this overwrite.

  • Author

With that said, on a rarely used environment you could likely get by without issue. Likewise in the future, if anything would change on the base unRAID distro or a new addon uses it, you might be spending time troubleshooting why something doesn't work unless you remember to double-check this overwrite.

 

Very true, thanks again!

I don't think it's good form to just use a saved static copy of a file that by it's nature should be dynamic.

 

With that said, on a rarely used environment you could likely get by without issue. Likewise in the future, if anything would change on the base unRAID distro or a new addon uses it, you might be spending time troubleshooting why something doesn't work unless you remember to double-check this overwrite.

I agree.  submit it as a "bug" to lime-tech.  It is their brain-damaged handling of crontab when dealing with the "mover" script that causes the issue.  They did not expect anybody else to be changing crontab.

 

I do not use the saved copy of crontab, emhttp does.  I always grab it dynamically using "crontab -l"

 

Joe L.

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.