Cron Schedule

ky41083

Member
Apr 5, 2021
5
0
6
41
Just did a fresh install of PVE. Going over the stock cron jobs I found this:

In /etc/cron.d/zfsutils-linux

Bash:
# TRIM the first Sunday of every month.
24 0 1-7 * * root if [ $(date +\%w) -eq 0 ] && [ -x /usr/lib/zfs-linux/trim ]; then /usr/lib/zfs-linux/trim; fi

Actually works out to the following schedule, as opposed to being the first Sunday of every month as the comment line suggests:
“At 00:24 on every day-of-month from 1 through 7.”

Per https://crontab.guru/#24_0_1-7_*_*

The scrub job in the same file is similarly mismatched. Is the schedule in the comment line, or the schedule in the actual job how it's intended to run?
 
Bash:
# TRIM the first Sunday of every month.
24 0 1-7 * * root if [ $(date +\%w) -eq 0 ] && [ -x /usr/lib/zfs-linux/trim ]; then /usr/lib/zfs-linux/trim; fi

Actually works out to the following schedule, as opposed to being the first Sunday of every month as the comment line suggests:
“At 00:24 on every day-of-month from 1 through 7.”
Yes but there is an additional check for sundays: [ $(date +\%w) -eq 0 ]. Therefore, if “At 00:24 on every day-of-month from 1 through 7.” and it's a Sunday (and trim exists), then run trim. The Sunday that is in one of the first 7 days of the month, is the first Sunday of the month.
 
  • Like
Reactions: ky41083
Ahhh ok, than you sir! I thought I was missing something ;-)
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!