I've not used fstrim, but I assume you're putting a fstrim command into
your crontab but concerned that it won't run if the machine is shut down
before the cron time comes round.
Have you seen the cron '@reboot' facility? This will run whatever command
you give it when Linux starts.
You might want to give it a script which checks for the existence of some
flag to tell it whether it wqants to run fstrim or not, depending on
whether fstrim got run by a regular scheduled cronjob (which could set
aforesaid flag).

best regards,
웃
Victor Churchill,
Netley Abbey, Southampton



On Wed, 9 Feb 2022 at 17:57, Hamish McIntyre-Bhatty <d...@hamishmb.com>
wrote:

> Hi there,
>
> I believe a while back I was talking about TRIM here, more specifically
> about it not running automatically on my systems, and I think someone
> recommended I enable fstrim.service with systemd.
>
> I finally got around to that, only to find that it was already enabled,
> and apparently not doing anything. As I don't leave my systems on 24/7,
> is it safe to assume that the timer isn't firing when the system is
> booted up later, after the configured time for TRIM has passed?
>
> If so, does anyone know how to configure a task like this to run when
> scheduled, or alternatively when the system is next booted up in the
> case that the event was missed?
>
> I know CRON can't do this, and I assumed the point of using systemd
> timers was that they could do this, but alas perhaps not. I assume there
> must be a standard way to do this, because it seems like a rather big
> omission, considering that other commercial operating systems Who Must
> Not Be Named (TM) seem to have had this feature for a while.
>
> Any ideas?
>
> Hamish
>
>
> --
>   Next meeting: Online, Jitsi, Tuesday, 2022-03-01 20:00
>   Check to whom you are replying
>   Meetings, mailing list, IRC, ...  http://dorset.lug.org.uk
>   New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk
>
-- 
  Next meeting: Online, Jitsi, Tuesday, 2022-03-01 20:00
  Check to whom you are replying
  Meetings, mailing list, IRC, ...  http://dorset.lug.org.uk
  New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk

Reply via email to