A Bash daemon for monitoring disk usage with configurable thresholds, automatic log rotation, and auto-unmount on threshold breach.
dskd runs as a background process and, on a configurable interval:
- Records the size of a watched directory (
du) - Records the percentage used of the filesystem containing it (
df) - Appends a timestamped entry to a log file
- Raises a
[WARN]entry if filesystem usage crosses the configured threshold - Unmounts the watched path automatically if usage meets or exceeds the threshold
- Rotates the log file once it grows past a configured line count
All settings live in dsk-daemon.conf, sourced by the daemon at startup:
| Variable | Description |
|---|---|
WATCH_PATH |
Directory to monitor |
LOG_FILE |
Path to the usage log |
Dang |
Seconds between each check |
WARN_PERCENT |
Filesystem usage % that triggers a warning and unmount |
MAX_LOG_LINES |
Log rotates once it exceeds this many lines |
1. Clone the repository:
git clone https://github.com/Blu3-Sky-Max/dskd-
cd dskd-2. Make the installer executable:
chmod +x dsk-install.sh3. Edit the config file:
Add your paths and settings to match your machine:
vi dsk-daemon.conf4. Run the installer as root:
sudo ./dsk-install.shThe installer will:
- Check all required files are present
- Copy the daemon to
/usr/local/bin/ - Copy the config to
/etc/dskd/ - Copy the service unit to
/etc/systemd/system/ - Enable and start the daemon via systemd
- Show status of daemon
To stop and remove dskd from your system:
sudo systemctl disable --now dsk-daemon
sudo rm /usr/local/bin/dsk-daemon
sudo rm -rf /etc/dskd
sudo rm /etc/systemd/system/dsk-daemon.service
sudo systemctl daemon-reloadExpected output:
Daemon lifecycle structure (start/stop/status/run via PID file, systemd unit layout) adapted from steps shared by tlp.
Copyright © 2026 Usman Olanrewaju. Licensed under the MIT License — see LICENSE for details.
