networking and openvpn does not work with hibernate-script

752 views Asked by At

after suspend-to-disk via hibernate-script I can't reach the internet. That happens since I use openvpn. Stopping network, restarting openvpn and the starting the network solves the problem. I want to configure hibernate-script to do this automatically. I tried setting RestartServices networking openvpn in hibernate.conf but this doesn't work (I think this first restarts networking and then openvpn but I need the openvpn restart in between).

Kind regards, Sebastian

1

There are 1 answers

0
yomytho On BEST ANSWER

As hibernate.conf doesn't seem to work I did this :

echo 'case "${1}" in
    hibernate|suspend)
    sudo service openvpn restart
    ;;
esac' | sudo tee /etc/pm/sleep.d/20_restart-openvpn
sudo chmod +x /etc/pm/sleep.d/20_restart-openvpn

This create a script called "20_restart-openvpn" (you can change the name of the script) and make it executable. I hope this can help you too ...