Run dispatcher.d script when lte device is unplugged



Hello everyone,

 

I hope this question has not been answered yet, bus since I did not find anything similar on the webz, I decided to use this mailing list.

 

We are currently working on an automated OpenVPN connection over LTE connections, i.e. whenever an LTE stick ist plugged in and the connection ist established, OpenVPN is required to be started automatically. Same thing vice-versa (stop OpenVPN service) when the device is unplugged.

We are trying to achieve this with a dispatcher.d script.

First part is working perfectly fine, OpenVPN is started as soon as the device is plugged in and the connection is established.

Second part (tear-down) is currently not working. As far as I can see the dispatcher.d script is not triggered on device disconnect.

 

Can someone verify this, had a smilar problem, or does anyone have a solution for this?

 

This is the dispatcher.d script (currently contains an excessive ammount of logging):

 

#!/bin/sh

# This is /etc/NetworkManager/dispatcher.d/lte

# Checks if a Huawei E3276s or E3272s device

# is brought up and sets routes and configures the

# interface for the FKIE LTE

case "$1" in

    wwpxxxxxxxxx | wwpxxxxxxxxx | lte0) ;;

    *) exit 0; ;;

esac

 

case "$2" in

        up|vpn-up) reason=BOUND; ;;

        down|vpn-down) reason=RELEASE; ;;

        *) logger Reason: $2; exit 0; ;;

esac

 

logger LTE Network manager dispatch $1 Reason: $reason

if [ $reason = BOUND ]

then

    logger LTE network manager dispatch script is configuring $1

    systemctl start openvpn-client@rhnlab.service

    logger LTE network manager dispatch script has configured $1

elif [ $reason = RELEASE ]

then

    logger LTE network manager dispatch script is unconfiguring $1

    systemctl stop openvpn-client@rhnlab.service

    logger LTE network manager dispatch script has unconfigured $1

else

    exit 0

fi

 

After some hours of headache, I am very thankful for any advice.

 

Best regards

 

Martin Chauchet, M.Sc.

Communication Systems

 

Fraunhofer Institute for Communication, Information Processing and Ergonomics FKIE

Zanderstraße 5

53177 Bonn

Telefon +49 (0)228 50212-481

mailto:martin chauchet fkie fraunhofer de

http://www.fkie.fraunhofer.de

 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]