74 lines
1.8 KiB
Markdown
74 lines
1.8 KiB
Markdown
# 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:
|
|
|
|
```sh
|
|
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`:
|
|
|
|
```sh
|
|
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`:
|
|
|
|
```ini
|
|
[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`:
|
|
|
|
```ini
|
|
[Unit]
|
|
Description=Schedule filesystem check for %I
|
|
|
|
[Timer]
|
|
OnBootSec=5m
|
|
OnUnitInactiveSec=12h
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
```
|
|
|
|
To enable:
|
|
|
|
```sh
|
|
systemctl enable mizule@-var-spool-burp.timer
|
|
```
|
|
|
|
This will trigger the check 5 minutes after the machine boots, and then again
|
|
every 12 hours.
|