Skip to content

ppkwebsites/watchdog-script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

WatchDog

pfSense is online...

/ \__

( @___ / O / (_____ / /_____/ U ppk

Windows script

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

  1. Set Variables At the top of the script, configure:

Windows batch script as example

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.

  1. 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.

  1. 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:

WatchDog

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.

About

Keeps pfSense alive

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published