nofus 0.1.0

A daemon for monitoring and reacting to the status of NFS mounts.
nofus-0.1.0 is not a library.

๐Ÿš€ Nofus - The NFS Mount Guardian

Rust License CI/CD

Nofus is a blazingly fast and memory-safe Rust-powered daemon that vigilantly monitors your NFS mounts and triggers custom actions based on their availability. Never get caught with stale mounts again! ๐Ÿ›ก๏ธ

โœจ Features

  • ๐Ÿ•ต๏ธ Real-time NFS Mount Monitoring using Linux inotify
  • โšก Configurable System Commands for mount/unmount events
  • ๐Ÿงช Dry-Run Mode for safe testing
  • ๐Ÿ“Š Verbose Logging for deep insights
  • ๐Ÿ”„ Periodic Health Checks (configurable interval)
  • ๐Ÿ“ YAML Configuration for easy setup

๐Ÿ“ฆ Installation

  1. Prerequisites: Ensure you have Rust installed (1.60+)

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    
  2. Install Nofus:

    cargo install --git https://github.com/kariudo/nofus
    

โš™๏ธ Configuration

Create config.yml in your working directory:

# Sample Configuration
mount_points:
  - "/mnt/nfs/share1"
  - "/media/cloud_storage"

delay_seconds: 5  # Check interval

# Commands to execute (supports full shell syntax)
all_mounted_cmd: "systemctl start my-app.service"
any_unmounted_cmd: "systemctl stop my-app.service && wall 'NFS Crisis!'"

๐Ÿšฆ Usage

nofus [OPTIONS]

Options:

  • --dry-run: Simulate without executing commands
  • --verbose: Show debug-level logging

Example:

nofus --verbose --dry-run

๐Ÿ–ฅ๏ธ Sample Workflow

2023-09-15T14:30:00 [INFO] Initial state: All NFS mounts available โœ…
2023-09-15T14:35:22 [ERROR] NFS mount disconnected: /mnt/nfs/share1 โŒ
2023-09-15T14:35:22 [DEBUG] Executing: systemctl stop my-app.service
2023-09-15T14:36:45 [INFO] Mount recovered: /mnt/nfs/share1 โœ…

๐Ÿค Contributing

We welcome contributions! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feat/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feat/amazing-feature)
  5. Open a Pull Request

๐Ÿ“œ License

MIT License - see LICENSE for details.