Wanchers-NG is a Linux utility that monitors the state of a mount by checking for a user-defined anchor file at specified intervals. It can automatically manage Docker containers based on the mount's state and notify you if any issues are detected and rectified.
- Create Installation Directory
The suggested location for the installation is /opt/scripts/misc/wanchers-ng/. You can change this to a directory of your choosing.
```bash
sudo mkdir -p /opt/scripts/misc/
sudo chown $USER:$USER /opt/scripts/misc/ -R`
```
Clone the Repository
```bash
git clone https://github.com/maximuskowalski/wanchers-ng.git /opt/scripts/misc/
```
-
Navigate to the directory containing the script.
```bash cd /opt/scripts/misc/wanchers-ng/ ```
-
Copy
.env.sample
to.env
.```bash cp .env.sample .env ```
-
Edit
.env
and fill in the necessary variables. To edit the .env file or any script, you can use a text editor like nano:```bash nano .env ```
Here is a breakdown of each setting in the .env
file:
USER_NAME
: User for the systemd service (e.g.,john
) Default is fine and will use your current username.LOGFILE
: Path for the log file (e.g.,/opt/scripts/misc/wanchers-ng/newwanchors.log
)webhook_url
: Webhook URL for notifications (e.g.,https://discord.com/api/webhooks/123/abc
)thisserver
: Hostname for Discord notification (e.g.,myServer
)new_anchor
: Path to the anchor file (e.g.,/mnt/storage/.mystorage
)docker_containers
: Array of Docker container names to manage (e.g.,("plex" "emby")
)TIMER_INTERVAL
: Interval for the systemd timer (e.g.,5min
)
-
Ensure that the installer script is executable:
```bash chmod +x install-wanchors-ng.sh ```
-
Run the installer script.
```bash ./install-wanchors-ng.sh ```
Once the installation is complete, the timer will start automatically.
To check the log file in real-time, you can use:
```bash
tail -f /opt/scripts/misc/wanchers-ng/wanchorsng.log
```
To check the status:
```bash
sudo systemctl status wanchors.timer
```
Feel free to open issues or pull requests to improve the project.
This project is licensed under the MIT License. See the LICENSE.md file for details.