[SLE] ifservices scripts for tun device
Hi, I have a tun0 device, created by the openvpn connection to another machine. I need to start some script _after_ the vpn is fully initialized - i.e. after the tun0 device is set up (it takes a little time). I tried to set this script as a service, which runs after all other services (incl. openvpn) are started, but it still fails, because it tries too early, before the tun device is up. So, looks like I have to go trough another route - like using all the infrastructure under if-up maybe, i.e. using ifservices-xxxx. I have created /etc/sysconfig/network/ifservices-tun0 directory, and put there links to the start/stop scrip, but it never gets kicked. Any ideas what's wrong, or how I can apporach this problem? Thanks -- -- Svetoslav Milenov (Sunny) Windows is a 32-bit extension to a 16-bit graphical shell for an 8-bit operating system originally coded for a 4-bit microprocessor by a 2-bit company that can't stand 1 bit of competition. -- Check the headers for your unsubscription address For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com Please read the FAQs: suse-linux-e-faq@suse.com
Sunny wrote:
I have a tun0 device, created by the openvpn connection to another machine. I need to start some script _after_ the vpn is fully initialized - i.e. after the tun0 device is set up (it takes a little time). I tried to set this script as a service, which runs after all other services (incl. openvpn) are started, but it still fails, because it tries too early, before the tun device is up.
Hi Sunny, this is probably not what you're after, but in situations like this where a connection may or may not be available, I make sure my software will retry.
So, looks like I have to go trough another route - like using all the infrastructure under if-up maybe, i.e. using ifservices-xxxx. I have created /etc/sysconfig/network/ifservices-tun0 directory, and put there links to the start/stop scrip, but it never gets kicked.
I suspect this is because openvpn creates it independently. Won't openvpn help you do it anyway? With its "--client-connect" option ? /Per Jessen, Zürich -- Check the headers for your unsubscription address For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com Please read the FAQs: suse-linux-e-faq@suse.com
On 7/31/06, Per Jessen wrote:
I suspect this is because openvpn creates it independently. Won't openvpn help you do it anyway? With its "--client-connect" option ?
/Per Jessen, Zürich
Thanks Per, client-connect is not suitable for this, as this machine is the client :) But you put me on the right track, using --up was what I needed. Now everything is just fine. -- -- Svetoslav Milenov (Sunny) Windows is a 32-bit extension to a 16-bit graphical shell for an 8-bit operating system originally coded for a 4-bit microprocessor by a 2-bit company that can't stand 1 bit of competition.
Sunny wrote:
Hi, I have a tun0 device, created by the openvpn connection to another machine. I need to start some script _after_ the vpn is fully initialized - i.e. after the tun0 device is set up (it takes a little time). I tried to set this script as a service, which runs after all other services (incl. openvpn) are started, but it still fails, because it tries too early, before the tun device is up.
So, looks like I have to go trough another route - like using all the infrastructure under if-up maybe, i.e. using ifservices-xxxx. I have created /etc/sysconfig/network/ifservices-tun0 directory, and put there links to the start/stop scrip, but it never gets kicked.
Any ideas what's wrong, or how I can apporach this problem?
Why not add a test to your script to verify the VPN is up? For example, you could try to ping the other end of the tunnel and if fail, pause and then retry. Once you have a successful ping, you can continue on with the rest of the script. -- Check the headers for your unsubscription address For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com Please read the FAQs: suse-linux-e-faq@suse.com
On 7/31/06, James Knott wrote:
Sunny wrote:
Why not add a test to your script to verify the VPN is up? For example, you could try to ping the other end of the tunnel and if fail, pause and then retry. Once you have a successful ping, you can continue on with the rest of the script.
Thanks James, I was thinking about such a solution, but if the vpn is never up, because of some problem, this init script will hang forever. And I'm not good enough in scripting to solve this problem. -- -- Svetoslav Milenov (Sunny) Windows is a 32-bit extension to a 16-bit graphical shell for an 8-bit operating system originally coded for a 4-bit microprocessor by a 2-bit company that can't stand 1 bit of competition. -- Check the headers for your unsubscription address For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com Please read the FAQs: suse-linux-e-faq@suse.com
participants (3)
-
James Knott
-
Per Jessen
-
Sunny