FEATURE REQUEST: Advanced cron settings for periodic snapshots

Hello!

When setting up the periodic snapshots with custom schedule, the schedule widget lack some functionality. For example you cannot set snapshots to be taken every first sunday of the month.

Ther could be also an additional text input next to days of week and months to input some extra syntax, so that mone has more control over schedule.
Extra syntax:
https://www.hostinger.com/tutorials/crontab-syntax

It would be great to be able to turn advanced mode on and type in own command like in this thread:
https://superuser.com/questions/428807/run-a-cron-job-on-the-first-monday-of-every-month

Additionaly there should be mention in help, for those who want, where the schedules are stored, if one desires to edit the containing text file in order to tailor schedule to own needs.

3 Likes

Its good to gather interest for Feature Requests here, but they should be submitted officially as SUGGESTIONS in the jira system … "report a bug " on top of this page.

You’ll get a NAS ticket ID which you can paste here. People can then upvote it.

I’m particularly interested in stories about how a feature will make systems more reliable or save hours of time. Why not just take snapshots every Sunday?

I personally find every week too often. My data does not change as much over time.
I know, that there is an option to avoid empty snapshots, but if I can schedule them once every month and on particular day of week, then I would gladly use that option instead say every 5th day of month disregarding day of week. Last one would raise my electricity bills, beacuse on workdays my server, which is a normal PC, would have to run without purpose for hours.

https://ixsystems.atlassian.net/browse/NAS-129090

The cost of more frequent snapshots (weekly) is very low.
If you need to restore, its good to have more options.

1 Like

The pane for snapshots is in imho, in need of quite a bit of work.
So I can understand OPs being unwilling to manage to many snapshots.

I do however have two older suggestions that would empower the Snapshot-section in the UI.
More powerfull search/filtering for snapshots
Increase the number of viewable snapshots, and remember default choice

Cron does not support a “first x-day of the month” schedule.

Ok, but you can at least use the ability of shell to evaluate expressions like in the second link from my first post. To use that the has to be a text field to put those command in.

Yeah would also like to see the same feature when scheduling SMART tests. Had the same issue where I couldn’t set up a Long SMART test to run on the first Saturday of the month.

This is in no way a TN issue or missing feature. Cron simply does not support “Nth X-day of the month”. Never did. And probably never will because that would break the current established semantics.

If you put “1st” and “Saturday” in your crontab, the job will execute on the first for every month and on every Saturday.

You can have every first of the month. Why is it important that that be e.g. a Saturday?

Kind regards,
Patrick

According to the superuserlink in OP, which also links to this,

It’s possible, but it’s not possible to enter in TrueNAS.

Hence the feature request.

The superuser link are just workarounds to check either the day of week or the “first N-day of month” condition in the executed code itself.

Of course you can do that in TrueNAS - that needs to go into the command field. Like with every cron implementation.

Example: (TN CORE)

Replace the echo "It's the first Saturday!" part with the real command you want to run.

HTH,
Patrick

According to the link, first Monday at 8am. May depend on cron implementation.

0 8 */32,1-7 * 1

No code there.

1 Like

I don’t see that syntax confirmed by the crontab manpage neither on Linux nor on FreeBSD or Mac OS, but if that indeed works as claimed, I do stand corrected.

E.g. the Mac OS manpage quite explicitly states what I have been writing:

Note: The day of a command’s execution can be specified by two fields — day of month, and day of week. If both fields are restricted (ie, are not *), the command will be run when either field matches the current time. For example, ``30 4 1,15 * 5’’ would cause a command to be run at 4:30 am on the 1st and 15th of each month, plus every Friday.

I would still be curious to know which implementations support that - and possibly since when.

Thanks,
Patrick

I don’t know if it works on TrueNAS, but according to the page it works in “classic (Vixie, Debian) cron”

So it very well might

And this explains it

As I understand it by using *, it counts as unrestricted so you get the sometimes AND behavior. Even though you then restrict it to an impossible day OR 1st week

3 Likes

That would be something I was thinking about, but then I have to know the exact command to trigger Snapshot (after wicht I have pipelined a backup to separate HDD).

GUI does not help much with that part :slight_smile:

That’s awesome! I definitely learned something new today, thanks.

Looks like a bug/oversight in the parser (only checking for the first character) turned into a feature.

And of course now this can never be changed in any way :sweat_smile:

2 Likes

I’ve tried syntax from Stux in GUI of scheduler.
Zrzut ekranu 2024-06-26 172311

Yeah, the input verifier is wrong.

Now that could be a bug report instead of a feature request :wink: