Script to Automatically Detect and Restart Linux PPTP Client

Attention: open in a new window. PDFPrintE-mail

The default PPTP client for Linux does not automatically start on boot, or restart on a failed or dropped connection. I have written a short script to ping your VPN server gateway IP address and start the PPTP client if a ping does not succeed.

Create this script and make it executable:

Add the below script to the file and change the following attributes for your own values:

  • your-vpn-host-or-ip-address
  • your-vpn-username
  • your-vpn-password

 

Add the following entry to your cron to execute the script every minute.

 

1
*/1 * * * * /root/cron/pptp_cron.sh >> /var/log/pptp_pinger.log 2>&1