I wanted to configure my HDD scrub to only run on the 1st Sunday of the month. Whatever day that actually lands on. And only once per month. Sounds easy enough
I thought I had done that, but in reality⌠and it gets very weird imo.
I cannot configure days to be 0-7, that is invalid (0 is invalid. which makes sense)
Configuring (only) 1 is wrong, because I want the first Sunday, not the first day of the month.
Configuring Sunday is wrong, because I only want it to run once per month.
Configuring 1-7 is correct in that the NAS is physically powered off the rest of the week at the cronjob times (this is what I had configured).
But 1-7 results into âBETWEEN" 1-7â, which is not helpful as well. The first run is emitted to be on the 2nd. Which is not a Sunday.
Configuring 1,1-7 actually emits that it would do it like I want, the words change to âone THROUGH sevenâ as well.
Why tf though is the 7 now suddenly âTHROUGHâ when it was âBETWEENâ before? With the same logic, it should now do 1+(2-6) requiring me to input 1,1-7,7. Otherwise it treat 1-7 differently depending on if thereâs other days mentioned around it (which would be very wtf).
=> this behaviour seems weird to me.
Is there an actual issue: Well yes. The NAS will see the light of day on Sundays. The logic becomes an OR once I play with the day-selector. So 1-7 has to be the thing.
But today, with a config of 1-7, the thing didnât do anything. No log, nothing. It says it will run the next time tomorrow - which is completely wrong of course.
The ânext runâ preview states it would run on the 1st though (see below for March). But then why didnât it run today. That makes me believe the wording âbetweenâ more than the preview.
Ideas? Am I doing something wrong?? Is this normal? Is this a cronjob limitation of linux in general? Very weird UX in any case (which doesnât have to be TrueNASâs fault).
The timezone is properly set over the whole system - I stumbled upon that a few weeks ago already when setting everything up. Shows the current time just as my PC does. The NAS was powered on ~1h before the job should have started, so no âtoo close to runtimeâ issue as well.
Because maybe at some point my NAS will run 24/7 and then the âfirst Sunday of the monthâ thing goes boom anyway (with the current options in the UI), no?
Otherwise: Thanks for a great and properly working software with much functionality ready to use. Perfect merger of ez and techyness!
Yes. Thereâs no way in cron syntax directly to do what youâre asking, and the TrueNAS UI tracks what cron can do. So what to do?
Set your cron job to run every Sunday, and include a conditional in your command to ensure that the day of the month is 1-7 (i.e., the first week of the month).
e.g., for your âCommand,â enter [ "$(date +\%d)" -le 7 ] && /path/to/whatever
Set your cron job to run days 1-7 of the month, and include a conditional to test if the day of the week is Sunday
Particularly if what you want to run is a script anyway, set the cron job to run every Sunday, or days 1-7 of the month, and include the conditional in the script.
No idea why tf even the system-created one doesnât run when adjusting to only stars (no date check yet mind you), yet the manual button works⌠running the cron command manually doesnât work as well.
Did something change with the commands/shouldnât that work? (I am elevated to root of course)
Isnât this already built into the UI for scheduling scrubs?
Configure a poolâs scrub to run weekly on Sundays. Choose a threshold value of 35 days.
Every Sunday, It will check if itâs been at least 35 days since the last scrub. If not, it skips scrubbing on that Sunday.
If you want it to line up with the first Sunday of the month, then you need to manually run a scrub on the first Sunday of a month before you enable the scrub task schedule.
Yes, for a 24/7 NAS that will work (with the additional manual work to align it, like you said).
Mine is powered down and only activated on demand. That usage might change, but for the foreseeable future wonât. I would have to plan around this with vacations and whatnot of special occasions that would cause me to miss it.
No idea why tf even the system-created one doesnât run when adjusting to only stars (no date check yet mind you), yet the manual button works⌠running the cron command manually doesnât work as well.
That making sense to anyone? Because I can easily script this into a working .sh, yet that doesnât help me if the thing doesnât do the thing afterwards