[SOLVED] Weekly cron fstrim job 17 October 2023, 20:00:36 Hello, everybody.So I want to setup a weekly cron (using cronie) job to trim my nvme drive. I copypasted an fstrim script from Ubuntu (allegedly) to /etc/cron.weekly Code: [Select]#!/bin/sh# trim all mounted file systems which support it/sbin/fstrim --all || trueand haven't done anything else. Should that suffice? (I do realize that I need to start/enable a service) Last Edit: 19 October 2023, 11:38:51 by Hitman
Re: Weekly cron fstrim job Reply #1 – 17 October 2023, 20:45:31 The file you have placed in /etc/cron.weekly needs to be executable. 1 Likes
Re: Weekly cron fstrim job Reply #2 – 18 October 2023, 12:07:35 Quote from: gripped – on 17 October 2023, 20:45:31The file you have placed in /etc/cron.weekly needs to be executable.Ok, I made it executable. Now I just enable the process and it'll work fine?
Re: Weekly cron fstrim job Reply #3 – 18 October 2023, 22:21:34 If you mean cronie then yes it should execute weekly if you enable cronie.If you want to be sure your cron job is being executed you could add Code: [Select]touch /root/it_worked to the end of your script and if the file it_worked appears in /root it was.or look in the logs for cron if you have logging setup. 1 Likes
Re: Weekly cron fstrim job Reply #4 – 19 October 2023, 11:17:04 Quote from: gripped – on 18 October 2023, 22:21:34If you mean cronie then yes it should execute weekly if you enable cronie.If you want to be sure your cron job is being executed you could add Code: [Select]touch /root/it_worked to the end of your script and if the file it_worked appears in /root it was.or look in the logs for cron if you have logging setup.Ok, thanks for helping me out!