Created
September 15, 2015 21:45
-
-
Save tribut/5103c2fd3195b6444b2f to your computer and use it in GitHub Desktop.
Btrfs scrub cronjob with logs from systemd's journalctl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# also see http://marc.merlins.org/perso/btrfs/post_2014-03-19_Btrfs-Tips_-Btrfs-Scrub-and-Btrfs-Filesystem-Repair.html | |
for fs in $(grep ' btrfs ' /proc/mounts | cut -d' ' -f1 | sort -u) | |
do | |
starttime="$(date "+%Y-%m-%d %H:%M:%S")" | |
logger "Starting btrfs scrub on $fs" | |
btrfs scrub start -Bd "$fs" | |
journalctl -q -k --since "$starttime" | grep BTRFS | |
logger "Scrub for $fs has finished" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment