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.