Periodic Snapshots and cron setting


I have been searching for an answer, but found none.
I’d like to set a cron job (or for that matter scheduled task) to run snapshots on every first sunday of the month. I have found no option to set task described (via GUI or config files) way, nor any new entry in cron files or new timer files in systemd.
Are there any other locations/files to set the schedule?

Best regards,

1 Like

I don’t think that will do what the OP wants since cron evaluates the “Days” part as 1-7 OR Days Sunday, not AND. At least it tells you that if you hover over the question mark there.

Yep. My problem is exactly that, what @neofusion says and that is why I have been looking in system files to change this setting to more accomodating my needs.

It would be great to have the choice between AND or OR in screen @Protopia shared or even some button to simply type in own cron schedule.

The screen shot says “days 1-7 and Sundays” - i.e. it will be on the first Sunday of the month since there is generally only one Sunday in the first seven days of the month.


Yes, that what it says, but when you change the month to next one, then, according to widget, you will get Snapshots every daty between 1st and 7th day of the month and on every sunday.

Because of that I wanted to find file, where web interface stores the cron task (I thought it would be crontab) and simply check what is going on there, just to be sure.

Turns out it may be trickier than it first appears.

There are a few potential solutions on this page.

Perhaps SUN#1

Or maybe the */32 solution.

Obviously Monday → Sunday

Can you enter the cron if you switch to custom?

1 Like

Thank you for the reply.

The screen I’ve shared is for the custom cron setting. Unfortunately you can change almost freely only the values for minutes, hours and day, but not days of week or months. It wouldn’t be a problem if I had known which files are to edit in order to tailor cron settings.

I could only enter */32 or simmilar. See screenshot.

I was wrong - there is even a :grey_question: icon on the UI that states explicitly that it is an OR operation.

So it appears that it is not possible to do this via the GUI.

There are some hacks on how to do this with a script on e.g. stackoverflow and elsewhere, and you could either script using ZFS CLI or using the TrueNAS CLI.

Feature request?

Thank you @Stux

For other, who are searching - here is feature request:

This may be a non-trivial request because I think that the GUI scheduling widget maps directly onto the Cron fields - and this is therefore actually more of a Cron shortcoming.

However, let’s wait and see what the results of the feature requests are.

This will schedule the job on days 1 to 7 and on every following Sunday.
Cron does not support the schedule the OP is asking for.