1
0
Fork 0
Mizule is a simple tool that checks the UUID of a mounted filesystem and issues a warning if it has not changed recently.
Go to file
Dustin 636f7dd408 Initial commit 2020-01-17 19:15:13 -06:00
src Initial commit 2020-01-17 19:15:13 -06:00
.gitignore Initial commit 2020-01-17 19:15:13 -06:00
Cargo.lock Initial commit 2020-01-17 19:15:13 -06:00
Cargo.toml Initial commit 2020-01-17 19:15:13 -06:00
README.md Initial commit 2020-01-17 19:15:13 -06:00
rustfmt.toml Initial commit 2020-01-17 19:15:13 -06:00

README.md

Mizule

Mizule is a simple tool that checks the UUID of the filesystem mounted at the specified path, and issues a warning if it has not changed within a given time period (default 30 days). This is useful, for example, to remind backup operators to switch out the backup disk periodically.

Usage

Check /var/spool/burp and warn if it has not changed in the last 30 days:

mizule /var/spool/burp

Check /var/spool/burp and warn if it has not changed in the last 10 days, sending an email to burp-admin@example.org:

mizule /var/spool/burp --ttl 30 --mailto burp-admin@example.org

Cache File

Mizule keeps track of the UUID of each of the filesystems it has seen in a cache file. This file is stored at ${XDG_CACHE_HOME}/mizule.json. If the XDG_CACHE_HOME environment variable is not set, ${HOME}/.cache is used. If the HOME environment variable is also not set, the cache file will be created in the current working directory.

Periodic Check with systemd Timer Unit

Mizule works best if it is scheduled to check the filesystem periodically. One way to set up this schedule is to use a systemd timer unit.

mizule@.service:

[Unit]
Description=Check last filesystem change for %I
RequiresMountsFor=%I
After=network-online.target
Wants=network-online.target

[Service]
Type=oneshot
Environment=XDG_CACHE_HOME=/var/cache/mizule
ExecStart=/usr/local/bin/mizule %I --mailto burp-admin@example.org

mizule@.timer:

[Unit]
Description=Schedule filesystem check for %I

[Timer]
OnBootSec=5m
OnUnitInactiveSec=12h

[Install]
WantedBy=multi-user.target

To enable:

systemctl enable mizule@-var-spool-burp.timer

This will trigger the check 5 minutes after the machine boots, and then again every 12 hours.