Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: [SOLVED] Weekly cron fstrim job (Read 576 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

[SOLVED] Weekly cron fstrim job

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)

Re: Weekly cron fstrim job

Reply #1
The file you have placed in /etc/cron.weekly needs to be executable.


 

Re: Weekly cron fstrim job

Reply #3
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.

Re: Weekly cron fstrim job

Reply #4
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!