pfSense is online...
/ \__
( @___ / O / (_____ / /_____/ U ppk
A simple batch script and shell script for Windows and Linux to monitor and restart pfSense VM running in VirtualBox on Windows and Linux.
๐ Features โ User confirmation prompt (with 10s timeout).
โ Ping monitoring of pfSense's IP address.
โ Automatic VM restart on failure detection.
โ Countdown timer while pfSense reboots.
โ Fun ASCII art when pfSense is online!
๐ Script Overview Filename: WatchDog-W.bat and WatchDog-L.sh
This script monitors a pfSense virtual machine by repeatedly pinging its IP address every 60 seconds. If it stops responding:
It will forcefully power off the VM.
Start the VM again.
Wait 240 seconds (4 minutes) to allow pfSense to boot properly.
Resume monitoring.
๐ How It Works
- Set Variables At the top of the script, configure:
set VM_NAME=pfsense set PFSENSE_IP=192.168.1.1 3. User Prompt When running the script:
It asks if you want to start the watchdog.
Auto-continues in 10 seconds if no choice is made.
- Connection Test Initially pings pfSense three times to verify reachability:
ping -n 3 %PFSENSE_IP% 4. Monitoring Loop Pings pfSense silently.
If unreachable:
Powers off the VM.
Starts the VM again.
Waits 4 minutes to boot.
If reachable:
Displays WatchDog ASCII art once.
- Countdown Timer A dynamic countdown timer appears while pfSense is rebooting.
โ๏ธ Requirements Windows OS.
Oracle VirtualBox installed.
VBoxManage.exe at C:\Program Files\Oracle\VirtualBox\VBoxManage.exe.
Correct pfSense VM name set in the script.
๐ผ๏ธ ASCII Art Preview When pfSense is online:
pfSense is online...
/ \__
( @___ / O / (_____ / /_____/ U ppk ๐ How To Use Edit watchdog.bat and set the correct VM name and pfSense IP.
Double-click watchdog.bat to start.
Let it run in the background!
๐ข Notes If you reboot pfSense manually, restart the script afterwards.
Adjust VBoxManage paths if needed.
๐ License MIT License โ free to modify, share, and improve.
โจ Future Improvements Add sound alerts.
Add email notification.
Advanced service checks beyond ping.