fcron_enable="YES"
cron_enable="NO"
Also add via sudo fcrontab -e -u root:
Code: Select all
&bootrun 0 0 1 * * /path/to/zfs-scrub.sh
This is the script zfs-scrub.sh:
Code: Select all
#!/bin/sh
export PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:~/bin"
#Monthly task to scrub the available zpools and check/fix errors
for pool in $(zpool list -H | cut -f 1)
do
/usr/bin/logger "Starting ZFS scrub on pool: ${pool}"
/sbin/zpool scrub ${pool}
/usr/bin/logger "Scrub finished on pool: ${pool}"
done
Now your pools should be scrubbed at 00:00 on the 1st of every month or if your machine was shut down at that time when you start up your machine, due to fcron.