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.

Safety Features

Featured Replies

Mine went off without a hitch. I forgot I even set it.

 

 

Cool stuff!!!

 

 

You could change the "0 0 1" in the script to "0 0 2", re-run it, and wait about 30 minutes.  It will start at midnight on the 2nd of the month.

 

Thanks for that info I was wondering what told it when to run.  What about the other two zeroes?  I assume one is the time?

 

 

 

  • Replies 83
  • Views 36.7k
  • Created
  • Last Reply

Thanks for that info I was wondering what told it when to run.  What about the other two zeroes?  I assume one is the time?

 

short answer

[pre]

          field        allowed values

          -----        --------------

          minute        0-59

          hour          0-23

          day of month  1-31

          month        1-12 (or names, see below)

          day of week  0-7 (0 or 7 is Sun, or use names)

 

    A field may be an asterisk (*), which always stands for ``first-last''.

 

    Ranges of numbers are allowed.  Ranges are two numbers separated with a

    hyphen.  The specified range is inclusive.  For example, 8-11 for an

    ``hours'' entry specifies execution at hours 8, 9, 10 and 11.

 

    Lists are allowed.  A list is a set of numbers (or ranges) separated by

    commas.  Examples: ``1,2,5,9'', ``0-4,8-12''.

[/pre]

 

Far more info here, with additional options to specify ranges of values:

http://www.rt.com/man/crontab.5.html

 

Joe L.

  • 1 month later...

I put the following commands in a file named monthly_parity_check.sh  I'll invoke it via the "go" script every time I reboot.

 

It will perform a scheduled parity check once a month on the 1st at midnight.  My server already has a script that monitors status, so that script will e-mail me hourly status reports when the parity check progresses. (It checks the array status once an hour)

 

Joe L.

 

 

#!/bin/sh

crontab -l >/tmp/crontab

grep -q "/root/mdcmd check" /tmp/crontab 1>/dev/null 2>&1

if [ "$?" = "1" ]

then

    echo "# check parity on the first of every month at midnight:" >>/tmp/crontab

    echo "0 0 1 * * /root/mdcmd check 1>/dev/null 2>&1" >>/tmp/crontab

    crontab /tmp/crontab

fi

 

 

Hmmmm....

 

I'm running Joe L.'s monthly parity check.  It surprised me last month when, all of a sudden, I saw a parity check going.  It turned out to be the 1st of the month.  However, looking at my admin page, it didn't run on 11/1.  Is there any good way to troubleshoot why it didn't run?  I'm up 24x7 now and it hasn't been shutdown in months, so I should have a long syslog.

 

 

That is so weird....mine did the same thing, ran fine last month but not this month. I just checked the cron jobs and it is in there.

I thought it was just me ???

 

Any Ideas??

Mine ran this month...  (still caught me by surprise)

Mine ran this month too.

  • 2 months later...

So, I never got around to fixing my non-running monthly parity check issue that cropped up back in November.  It didn't run in December either, but guess what?  It ran on January 1st.  Maybe my unRAID made a New Year's Resolution to increase its reliability. ???

I have modified Joes script to look, like this:

#!/bin/sh
crontab -l >/tmp/crontab
grep -q "/root/mdcmd check" /tmp/crontab 1>/dev/null 2>&1
if [ "$?" = "1" ]
then
    echo "# check parity every Sun at 1 am:" >>/tmp/crontab
    echo "0 1 * * Sun /root/mdcmd check 1>/dev/null 2>&1" >>/tmp/crontab
    crontab /tmp/crontab
fi

 

If i have done the research correctly this should do the check every sunday morning at 1am. I have added this line to my go file

/boot/scripts/weekly_parity_check.sh

 

Now, from my understanding when the comptuer reboots it should execute this and i should see it when i do a crontab -l.  The problem is that after a reboot it is not added.  If i navigate to the /boot/scripts folder and type weekly_parity_check_.sh into the terminal it works just fine.  I get the command prompt back and if i then run the crontab -l command it is added to the end.

 

Any reason why this might be?

 

Perhaps because

weekly_parity_check_.sh

is not equal to

weekly_parity_check.sh

 

Or, you might need to make the script executable (if you do have the right name)

type:

chmod +x /boot/scripts/weekly_parity_check.sh

 

In either case, you can make a copy of the "go" script, give it a different name of "go_copy", delete the line invoking "emhttp" (because it is already running and you don't want to start another) and then

type:

sh -xv /boot/config/go_copy

and see what it does... the -xv options will show you the lines as they are executed and you will see any error messages.

 

Once you see the error, (wrong name, wrong path, extra CR characters at ends of lines) you can fix it.

You can get rid of "CR" characters by typing

fromdos /boot/config/go_copy

 

Joe L.

  • Author

Here is what I thought the standard was for startup configuration.  Please correct me if this is outdated.  I am trying to follow the standard and not set the standard.

 

In my /config/go file I have the line ...

 

fromdos < /boot/custom/etc/rc.d/rc.local_startup | sh

 

right after the emhttp line.  This is the only addition to my /config/go file.

 

In the directory /custom/etc/rc.d I have a file called rc.local_startup.  I won't copy it here for fear of posting something out of date, but it has instructions to process every file in that directory except for rc.local_startup (itself) and rc.local_shutdown.  (I do not have an rc.local_shutdown).  The files process based on their sort order:

 

In that directory I have the following files - some of them I created myself, others I put there becuase instructions said to do so, others installed there by themselves I think  ...

 

S02-nomover (replaces the mover script with a null file, disabling the mover functionality)

S03-timezone (copies my custom timezone file)

S05-sleep (sleeps for 30 seconds to give unRAID a chance to bring the array online)

S09-bjp_custom (sets read ahead - currently commented out - and define custom samba shares)

S10-install_custom_packages (works in conjunction with unmenu package manager)

S20-smartlog (runs smart reports and saves the history if ever needed - also saves syslogs in a similar way)

S30-inittab-powerdown (provided by WeeboTech to install ctrl-alt-del launching of powerdown script)

 

Whenever I want something else to happen during startup, I just decide when in the sequence I want it to happen and name the script file accordingly, and put it in this directory.

 

I do not have a scripts directory.

 

Is this correct?

In my /config/go file I have the line ...

 

fromdos < /boot/custom/etc/rc.d/rc.local_startup | sh

 

This was my startup convention. I'm still using it. I don't recall another recommended startup mechanism.

However, Joe and Bubba may have created a newer one using the unMENU program.

Here is what I thought the standard was for startup configuration.  Please correct me if this is outdated.  I am trying to follow the standard and not set the standard.

<snip>

Whenever I want something else to happen during startup, I just decide when in the sequence I want it to happen and name the script file accordingly, and put it in this directory.

 

I do not have a scripts directory.

 

Is this correct?

You have an almost identical configuration as me.  I have the same line in the "go" script, and it invokes the script in /boot/custom/etc/rc.d that in turn invokes all the others in the rc.d directory.

 

The person with the "/boot/scripts" directory is non-standard (compared to us,. that is).

 

It is far easier with a standard defined for all to follow.  Some have never been exposed to it.    Some day we'll get it even better organized, but for now you have to love "standards"  if you don't like the existing "standard" you can invent your own. (Just ask "Microsoft," they do it every day)

 

Joe L.

  • Author

I am, BTW, very happy with the way this works.

 

I particularly like that all of the startup activity gets logged in the syslog!

 

I am indeed using a different setup, not because i meant to though.  I just started putting the scripts in there so that i had a central repository to keep them in.

 

I assume that most of you guys are using the layout proposed here:

http://lime-technology.com/wiki/index.php?title=Third_Party_Boot_Flash_Plugin_Architecture

 

If so then i am more then willing to move to that layout, especially if it makes it easier to diagnose the problem.

 

Also, bjp999 you said you have an rc.local_start file in there.  I know you are hesitant to post it but could you please.  I would love to see what is in the file and how it is laid out.  If setting up this structure simplifies things then i am all for it.

 

Thanks for the help guys

  • Author

I do not remember where I got it, but here it is.  I think it was from WeeboTech.

 

#!/bin/bash
logger -trc.local_startup -plocal7.info -is "Initiating Local Custom Startup."
scripts=`ls /boot/custom/etc/rc.d/ | egrep -v "rc.local_startup|rc.local_shutdown"`
cd /boot/custom/etc/rc.d
for script in $scripts
do scriptbase=${script##*/}      # Strip pathname
   ( echo "Processing $script" 
fromdos < $script | sh -xv
   ) 2>&1 | logger -t$scriptbase -plocal7.info -is
done

 

That is my script.

I think Joe has a slightly enhanced version of it.

 

Probably should make this into an easily installable package like the powerdown package.

 

That is my script.

I think Joe has a slightly enhanced version of it.

 

Probably should make this into an easily installable package like the powerdown package.

 

 

Agree 100%.  I found the powerdown package when i first got unmenu up and running and it has been great.  I use it quite a bit.  I have been messing with getting a link to the BubbaRaid interface into unmenu and have been unsuccessful so far, not quite sure why.

 

 

EDIT:  Ok, i have the setup my directories so that they match the ones proposed on the Wiki.  And i got the script to load.  Thanks bjp999 for posting the rc.local_startup file.  I created that, ran it through fromdos, ran my go script through fromdos, and did the step Joe outlines to check what was going on.  Turned out i has some stuff missed named, along with a few other stupid things.  Anyway, it seems to be working now and just wanted to let everyone know and thank you all for the help.

  • 1 year later...

Guys,

 

I know this is an old post but I only just discovered this functionality and think it is a GREAT idea. However, I've got another noob question to ask.

 

The wiki and this post say to use a 'Linux-friendly' text editor so that no carriage returns are entered, but no example app is given. I don't know any 'Linux-friendly' text editors - can someone suggest one?

 

Thanks!

Guys,

 

I know this is an old post but I only just discovered this functionality and think it is a GREAT idea. However, I've got another noob question to ask.

 

The wiki and this post say to use a 'Linux-friendly' text editor so that no carriage returns are entered, but no example app is given. I don't know any 'Linux-friendly' text editors - can someone suggest one?

 

Thanks!

See here in the wiki: http://lime-technology.com/wiki/index.php?title=UnRAID_Topical_Index#Editors

 

The favorite seems to be Notepad2.   Personally, I use "vim" because it supports the "vi" command keys that I know very well.

 

Edit, I also added a link in the wiki to the page listing the editors.

Joe L.

Thanks Joe, really want to give this a try!

One last question - another noob one unfortunately!

 

When it comes to adding a line to the go script, I see many are using the line 'boot/monthly_parity_check.sh'

 

Does that mean the sh file needs to reside in a subdirectory called 'boot', or am I misinterpreting this?

 

At the moment I've got the monthly_parity_check.sh file sitting directly in my flash directory.

The editor I'm using is Editpad Lite.  I share out \\tower\flash and I do all the editing from my windows machine.  Editpad lite has tabs for multiple documents.  It updates the view when the file changes on the drive.  It allows you to create files and save them as linux text files.  Very nice.

One last question - another noob one unfortunately!

 

When it comes to adding a line to the go script, I see many are using the line 'boot/monthly_parity_check.sh'

 

Does that mean the sh file needs to reside in a subdirectory called 'boot', or am I misinterpreting this?

 

At the moment I've got the monthly_parity_check.sh file sitting directly in my flash directory.

The \\tower\flash "shared directory" is actually the USB flash drive, mounted in Linux at /boot, therefore, if you put a line in the go script referring to

/boot/monthly_parity_check.sh

it is referring to the correct location.  You do not want, or need, a sub-directory on the flash drive named "boot"

 

Joe L.

  • 2 years later...

I put the following commands in a file named monthly_parity_check.sh  I'll invoke it via the "go" script every time I reboot.

 

It will perform a scheduled parity check once a month on the 1st at midnight.  My server already has a script that monitors status, so that script will e-mail me hourly status reports when the parity check progresses. (It checks the array status once an hour)

 

Joe L.

 

 

#!/bin/sh

crontab -l >/tmp/crontab

grep -q "/root/mdcmd check" /tmp/crontab 1>/dev/null 2>&1

if [ "$?" = "1" ]

then

    echo "# check parity on the first of every month at midnight:" >>/tmp/crontab

    echo "0 0 1 * * /root/mdcmd check NOCORRECT 1>/dev/null 2>&1" >>/tmp/crontab

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

    crontab /tmp/crontab

fi

Edit: added line to copy new /tmp/crontab to file in /var/spool/cron/crontabs read by unraid management interface. That way, changes made using it will not overwrite this entry for the monthly parity check. 

 

Edit: Added NOCORRECT key-word, so that the monthly check will not correct parity, but check it.  This will prevent a bad data disk drive from overwriting parity with bad parity calculations because the data read from it is inconsistent.

 

I want to set up a monthly parity check and want to make sure I do it right.

 

Do I just add the above commands to the go script?

 

I'm guessing not as you say you've added it to monthly_parity_check.sh

 

Can you tell me what to add to the go file and how I add to the monthly_parity_check.sh file. Where can this be found?

 

Any help appreciated.

 

Also if the server is off on the first of the month does the check take place when it's next turned on e.g. the 5th of the month?

If you are doing this in the 5.X series, do NOT add this line.

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

 

It was needed in the 4.X series, but in the 5.X series it is not needed AND it results in many warning messages in the syslog about an invalid user "root-"

 

 

other than that, it will work just fine.

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.