Restart service on internet connectivity loss

New to Debian (Or Linux in general)? Ask your questions here!

Restart service on internet connectivity loss

Postby Sharpey » 2018-03-17 20:46

Hi, this is my first post so please go easy. By profession I'm an Azure engineer, but Linux really isn't my strong point - just started off.

My question is as per subject, but the reason is that I've turned my raspberry pi into a VPN router. This had gone well as a first project. Connects on startup, routes all Ethernet traffic though the VPN interface nicely. Only issue is, if I get a dropout on my main internet router, openvpn by default, doesn't reconnect. Is there a way to enforce this, or do I need to have a background service running that will say ping and on packet loss, restart the openvpn service?

Thanks in advance for any help given.
Posts: 1
Joined: 2018-03-16 15:00

Re: Restart service on internet connectivity loss

Postby debiman » 2018-03-18 07:06

we are talking about systemd services?
first of all, you should look at the existing service:
Code: Select all
journalctl -b -u openvpn
systemctl status openvpn
nano /path/to/openvpn.service
(assuming it is called openvpn)

systemd uses targets, one of them is called
i'm not sure if it will enter a failed state that you can query with another systemd setting...

suggested reading:
User avatar
Posts: 3064
Joined: 2013-03-12 07:18

Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 10 guests