How can I set the OnCalendar to run once in a 3 months period?

How can I set the OnCalendar to run once in a 3 months period? Starting counting from now?

I would like to:

Balance - timer set for 90 days.
Defrag - timer set for 90 days.
Trim - fstrim.timer will run it automatically once a week, so no changes here.
Scrub - btrfsmaintenance will run it automatically once a month, its already set, no changes here.

I would be using the Drop-in method systemctl edit unit.timer to avoid breakage in package update and keep settings.

Would something like this be valid argument for On Calendar?
[Timer]
OnCalendar=0y 3month

You can use quarterly

The documentation is here:
https://man.archlinux.org/man/systemd.time.7

That being said, I don’t think you can modify the Btrfs Maintenance timers manually because Btrfs Maintenance manages those files and will change them on you.

2 Likes

Thanks Dalto, really appreciate you sharing your know-how with us

2 Likes

As @dalto mentioned, btrfsmaintenance will update its timers automatically. If you need to change their frequency, parameters, or disable/enable, you need to edit the file /etc/default/btrfsmaintenance. This file will not be changed with a package update.

1 Like

Yes, I proceeded like that.

After the change, I had to run sudo systemctl start btrfsmaintenance-refresh-service to apply it to the systemd timers. You don’t need to keep the service enabled, just run it once and will refresh the timers.

Now I don’t have to worry about anything :slight_smile:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.