Shell Bash

VPN Check & Restart

Bash script that monitors PPTP and OpenVPN client connections and automatically re-establishes the VPN link when it drops. Designed to run via cron every 15 minutes.

A minimal but reliable shell script for keeping VPN connections alive on Linux servers and desktops. Supports both PPTP and OpenVPN protocols.

Features

  1. Checks whether the VPN interface is active
  2. Attempts reconnection automatically if the link is down
  3. Supports PPTP and OpenVPN
  4. Cron-friendly — runs silently, logs failures only
  5. Tested on Debian and Ubuntu

Usage

Schedule via cron every 15 minutes:

0,15,30,45 * * * * /bin/bash /path/to/vpn_checking.sh