Artix Linux Forum

Artix Linux => System => Topic started by: epicbattle on 17 October 2023, 20:00:36

Title: [SOLVED] Weekly cron fstrim job
Post by: epicbattle on 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 || true
and haven't done anything else. Should that suffice? (I do realize that I need to start/enable a service)
Title: Re: Weekly cron fstrim job
Post by: gripped on 17 October 2023, 20:45:31
The file you have placed in /etc/cron.weekly needs to be executable.
Title: Re: Weekly cron fstrim job
Post by: epicbattle on 18 October 2023, 12:07:35
The 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?
Title: Re: Weekly cron fstrim job
Post by: gripped on 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.
Title: Re: Weekly cron fstrim job
Post by: epicbattle on 19 October 2023, 11:17:04
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.
Ok, thanks for helping me out!