kdave / btrfsmaintenance

Scripts for btrfs maintenance tasks like periodic scrub, balance, trim or defrag on selected mountpoints or directories.
GNU General Public License v2.0
900 stars 79 forks source link

Feature Request for more versatile periods #65

Closed CorrosiveTruths closed 4 years ago

CorrosiveTruths commented 5 years ago

I wish to have the scrub run on the 1st Saturday of the month at 9am. Midnight doesn't make much sense for me (I'll likely shut down the PC before it has a chance to finish), nor does just doing it on whatever happens to be the first day.

I set BTRFS_SCRUB_PERIOD="Saturday --1..7 9:00" in the config, but the next run is on midnight on the 1st. After this run it will be on the first Saturday on the month @ 9:00. So it runs twice a month.

I realise that the valid options are 'Type: string(none,daily,weekly,monthly)', so probably not a bug, but a feature request to support the full set of https://jlk.fjfi.cvut.cz/arch/manpages/man/systemd.time.7#CALENDAR_EVENTS

adrfantini commented 5 years ago

I would also like this feature to be implemented: I have a small server running in the same room where I sleep, so I do not want disks to spin up during the night. Currently, scrubs are performed monthly at 10:00AM: can I replicate something like this using btrfsmaintenance?

kdave commented 5 years ago

Thanks for the suggestion. The documented periods originated from the cron setups that pre-created the daily/weekly/monthly periods as the most common. When the systemd timer support was added, the periods were copied, but in fact the rich format of calendar events is already supported. This will be better documented.

adrfantini commented 5 years ago

You mean that I could already set a systemd calendar string as periodicity and it would work?

CorrosiveTruths commented 5 years ago

Oh cool.

I'll file a separate bug about the double-running behaviour then.

(I'm guessing because it uses the /etc/systemd/system/btrfs-trim.timer.d/schedule.conf drop-in, but also the /lib/systemd/system/btrfs-trim.timer which contains 'monthly' but I'd like to prove that to myself first)

CorrosiveTruths commented 5 years ago

See #71

CorrosiveTruths commented 5 years ago

Re-opened, just realised you're tracking this issue for 0.5

kdave commented 4 years ago

The patches adding documentation (and some validation) have been merged.