]> git.somenet.org - root/pub/somesible.git/blob - roles/base/btrfs-helpers/templates/cron.j2
[roles/base/btrfs-helpers] possibly install btrfs helper scripts
[root/pub/somesible.git] / roles / base / btrfs-helpers / templates / cron.j2
1 #
2 ################################################
3 ### Managed by someone's ansible provisioner ###
4 ################################################
5 # Part of: https://git.somenet.org/root/pub/somesible.git
6 # 2017-2024 by someone <someone@somenet.org>
7 #
8
9 {% if setup_btrfs_scrub_monthly | bool %}
10 # scrub filesystems disk-wise every quarter.
11 # first seems faster and less stalling with btrfs raid6.
12 0 2 9 */3 * root btrfs filesystem show -m -d | grep devid | awk '{ print $8 }' | xargs -n 1 -- btrfs scrub start -c 3 -B -d | tee /tmp/btrfs-scrub.log
13 #0 2 9 */3 * root mount | grep "on /btrfs/" | awk '{ print $3 }' | xargs -n 1 -- btrfs scrub start -c 3 -B -d | tee /tmp/btrfs-scrub.log
14
15 {% endif %}
16 {% if setup_btrfs_snapshot_daily | bool %}
17 # Take a new snapshot every midnight.
18 0 0 * * * root (/btrfs/btrfs-snapshot.sh; /btrfs/btrfs-regen-snaphot-homelinks.sh) &> /tmp/btrfs-snapshot-daily.log
19
20 {% endif %}
21 {% if setup_btrfs_snapshot_reboot | bool %}
22 # Take a new snapshot every reboot.
23 @reboot   root (/btrfs/btrfs-snapshot.sh; /btrfs/btrfs-regen-snaphot-homelinks.sh) &> /tmp/btrfs-snapshot-reboot.log
24
25 {% endif %}
26 {% if not setup_btrfs_snapshot_daily | bool and not setup_btrfs_snapshot_reboot | bool and not setup_btrfs_scrub_monthly | bool %}
27 # Nothing configured.
28
29 {% endif %}