Systemd and starting another program after OpenVPN finishes connecting

I have a program that I want to launch only when OpenVPN has established a connection.  The problem is it is instead starting too soon, and going out into the Internet first before later using the OpenVPN connection.  I am having it start after OpenVPN with the following two lines in the .service file:
Requires=[email protected]
After=[email protected]
Is there a proper way to have it instead start after OpenVPN finishes its connection?  Right now I manually can start it after systemctl status [email protected]
reports:
Initialization Sequence Completed
But that manually method is very much suboptimal.  I also want to have this other program start at boot which would completely preclude the manual method.

What if you use Requisite=[email protected]?  As I understand it, that will ensure that the service is active and running before allowing the next to start...
Additionally, if you want to be able to start the unit manually, without the openvpn.service started (that is by using "systemctl start <whatever>"), then you could use RequisiteOverridable=[email protected]
Edit: I guess there is also the additional question of whether the unit reports a success after starting the binary or actually making a connection.  I have never used openvpn, so I don't know about this.  But take, for example, the network.target and the network management services.  With the exception of NetworkManager.service (more specifically the NetworkManager-wait-online.service), the service is reported as successful, and the network.target is reached when the daemon itself is started, not when a full connection has been established.  If it reports success before full connection, that will make this much harder.
Last edited by WonderWoofy (2013-07-05 17:50:00)

Similar Messages

  • I try to make update for my iphone and start showing itunes need to be connected and never start and i connect my phone on itunes but it say need to be format for phone .please help me .

    I try to make update for my iphone and start showing itunes need to be connected and never start and i connect my phone on itunes but it say need to be format for phone .please help me .

    Hello Huss87bash,
    This screen indicates that the device is in recovery mode, and must be restored in iTunes before it can be used again.
    If you can't update or restore your iOS device
    http://support.apple.com/kb/HT1808
    Once the device has been restored, you should be able to restore your device from a backup to replace all of your content and settings.
    iOS: Back up and restore your iOS device with iCloud or iTunes
    http://support.apple.com/kb/HT1766
    Cheers,
    Allen

  • Can not start a program after upgrade to version 5.0

    I upgrade the iphone to version 5.0 and after that I can not start any program installed exept for the program that come with the phone

    Ray,
    You might have been there but I would like to know are there any error footprints in the logs?
    eg.:
    on OVMM: */var/log/ovm-manager/*
    on OVM server: */var/log/xen/* && */var/log/ovs-agent/*
    --Dheeraj.                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Opening and manipulating another program from an application or script

    Hello all,
    I'm trying to create a prototype of a portable input device for a computer. The idea is that the input device allows the same input as a normal wireless pen tablet, but augmented with special features, which could (for example) open programs and switch between them.
    Now our current idea is to use a second monitor to run our mockup interface on. So basically an application of some sort that has a rectangular part to serve as the pen input area and some buttons alongside it for the extra functionality.
    Now for the questions: is it possible to open and interact with programs on the mac through another application? Would Applescript or a Cocoa application be able to this?

    Hi Spacy, and welcome to the Dev Forums!
    SpacyRicochet wrote:
    is it possible to open and interact with programs on the mac through another application?
    Yes.
    Would Applescript or a Cocoa application be able to this?
    Both.
    However, opening another app and interacting with it are two different topics. In general, you'll always be able to open another app. But except for privileged programs such as debuggers, you can't expect to do much else with another app unless it wants you to. In other words, if you programmed the other app, you'll be able to control and interact with it anyway you want from either Applescript or a Cocoa app. But if the app doesn't support Apple Events or any other kind of interprocess communication (IPC), you may not be able to do much except open and close it.
    Here are some links that might be useful to you:
    [Introduction to AppleScript Overview|http://developer.apple.com/mac/library/documentation/AppleScript/Conce ptual/AppleScriptX/AppleScriptX.html#//apple_ref/doc/uid/10000156-BCICHGIE]
    [Introduction to Cocoa Scripting Guide|http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Scr iptableCocoaApplications/SAppsintro/SAppsIntro.html#//appleref/doc/uid/TP40001982-BCICHGIE]
    [NSWorkspace Class Reference|http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ ApplicationKit/Classes/NSWorkspaceClass/Reference/Reference.html#//appleref/doc/uid/TP40004153]
    [Getting the main window of an app via an NSRunningApplication instance|http://stackoverflow.com/questions/1981453/getting-the-main-window-of- an-app-via-an-nsrunningapplication-instance]
    Hope that helps!
    \- Ray

  • Can't start any program after upgrading to Mavericks from Mountain Lion.

    After upgrading my Macbook Pro from Mountain Lion to Mavericks, I can't start any program from the dock or finder.  The screen flashes briefly gray, then returns to the desktop.  I repairded permissions from the recovery partition.

    No need to repair permissions from the recovery partition. You can do that using the Disk Utility app located in HD > Applications > Utilities.
    As for the issues with your Mac. Check to see if the startup disk needs reparing. (not the same as permissions)
    The startup disk may need repairing ...
    Launch Disk Utility located in HD > Applications > Utillities
    Select the startup disk on the left then select the First Aid tab.
    Click:  Verify Disk  (not Verify Disk Permissions)
    If DU reports errors, restart your Mac while holding down the Command + R keys. From there you should be able to acces the built in utilities in  OS X Recovery
    Make sure to back up all important files first before using OS X Recovery.

  • Just got a mac air and started using it. after getting it set up i migrated files from my old pc.  i did not realize that the files migrated to a different user account.  how do i delete this user account and not lose the migrated files which i need

    I just got a mac air and set it up and started using. after getting famiiar with it i migrated my files from my old pc. i did not realise that the files migrated to a new user account.  how do i delete this user account but not lose the migrated files?

    Mac 101: File Sharing
    Mac OS X 10.7 Help: Transfer files between two Mac computers
    Mac OS X 10.7 Help: Set up a Windows computer to share files with Mac users
    Mac OS X 10.7 Help: Use iDisk to share files
    Mac OS X: Sharing your files with non-Apple computers
    How to share a Mac's files with a PC and vice versa.

  • I have reloaded Icloud on my Windows 7 PC and it just says it stopped working and closes the program after I enter my apple password, what can I do?

    I am unable to use Icloud on my Dell PC. I have uninstalled it twice and reloaded it. When I enter my Apple password, it tells me that it has stopped working and closes the program. What can I do to correct this.

    Hi MamaTabs,
    If you are having issues signing in to iCloud on your Windows machine, you may find some of the troubleshooting in the following article helpful:
    iCloud: Account troubleshooting
    http://support.apple.com/kb/ts3988
    Also, you may want to make sure that you are running the most recent version of iCloud Control Panel for Windows:
    Apple: iCloud Control Panel 3.1 for Windows
    http://support.apple.com/kb/dl1455
    Regards,
    - Brenden

  • Threads - Multithreaded app. - How to cancel one and start another?

    I've searched through the forums for some direction on this but have been unsuccessful in finding anything I could use yet.
    What I am trying to accomplish is the following:
    1. I have a multithreaded application
    2. User can enter login information and then initiate the login thread by clicking the login button
    3. Login button turns into a Cancel button during login attempt
    4. If user changes their mind, they can initiate the cancel login thread by clicking the cancel button
    How can I stop the login thread and start the cancel thread? Reading through the API (1.3.1), it seems that necessary methods have been depreciated. Could anyone offer me any insight/examples?
    Thanks,
    KJ

    Have a boolean variable in the login thread which is checked at various points through the process and set to true when login starts. When the user clicks cancel, set it to false, then the login thread will end itself next time it checks the boolean.

  • My iPhone 5 says it is connected to iTunes and starts syncing when it isn't connected

    Everytime I open my itunes it says that my iphone is conncted and starts to tell me it is syncing the content, how can I fix this? thanks

    Hello Probes13,
    It sounds like Wifi syncing may be enabled in iTunes. The article iOS: Syncing with iTunes found here http://support.apple.com/kb/ht1386 outlines how to enable Wifi syncing but rather than checking the box that enables it, you would uncheck it.
    Wi-Fi syncing
    Open iTunes
    To set up Wi-Fi syncing, connect your iOS device to your computer with the included USB cable. Select your device under Devices on the left-hand side.
    In the Summary tab, select "Sync with this [device] over Wi-Fi".
    Whenever the computer and the iOS device are on the same network, the iOS device will appear in iTunes, and you can sync it. The iOS device will sync automatically when all of the following are true:
    The iOS device is plugged in to power
    iTunes is open on the computer
    The iOS device and the computer are on the same Wi-Fi network
    While the iOS device appears in the left-hand column of iTunes, you can select the content tabs and configure sync options.
    Click Apply or Sync to sync the iOS device.
    If the iOS device does not appear in the Devices section or you are unable to sync, please see this article for troubleshooting.
    Regards,
    Sterling

  • I-tunes don't run anymore on pc. MSVCR80.dll is missing in program. the advice is to install I-tunes again and it will be fixed but after downloading I-tunes again on pc and start again program I receive  same default msg :-(

    I-tunes don't run anymore on pc.
    default msg that MSVCR80.dll is missing.
    after re instlation of I-tunes program it would be fixed but it isn't.
    somebody a solution?

    Solving the iTunes Installation Problems in Windows
    1. Apple has posted their solution here: iTunes 11.1.4 for Windows- Unable to install or open - MSVCR80 issue.
    2. If the Apple article does not fully resolve the problem for you, then try Troubleshooting issues with iTunes for Windows updates - MSVCR80.
    iTunes 11.1.4 for Windows- Tips for Unable to install or open - MSVCR80

  • How do I reset and start another game.

    Hello
    Please can someone help, I have spent several days on this and still can't get it to work.
    The code below is ok, I am playing a bowling game using the keyboard and timer with a text readout of the elapsed time, the bowl moves a set number of pixels on the screen.  whilst in full screen mode I would like to click a start/play button on the screen to start the game and timer again, everything is in frame 1.  Also I would like the game to just accept the keycode 77 and keyboard event (2 events only to move the bowl) and then wait for the start/play button click.
    Thanks
    Mick
    import flash.utils.Timer;
    import flash.events.MouseEvent;
    import flash.events.TimerEvent;
    var totalTime:Number = 0;
    var startTime:Number;
    //stop();
    var bowlTimer:Timer = new Timer(1,6000);
    //startButton.addEventListener(MouseEvent.CLICK, startTimer);
    bowlTimer.addEventListener(TimerEvent.TIMER, moveBowl);
    //bowlTimer.addEventListener(TimerEvent.TIMER_COMPLETE, endTimer);
    /*function startTimer(e:MouseEvent):void
    clockTimer.start();
    trace("Timer started");
    startButton.visible = false;
    function moveBowl(e:TimerEvent):void
    myBowl.x = myBowl.x + 70;
    trace("Timer cycle expired");
    /*function endTimer(e:TimerEvent):void
    trace("Timer finished");
    stage.addEventListener(KeyboardEvent.KEY_DOWN,keyDownHandler);
    var myKeyBoolean = false;
    function keyDownHandler(event:KeyboardEvent)
    if (event.keyCode == 77)
      bowlTimer.start();
      startTime = getTimer();
    else if (myKeyBoolean == false)
      bowlTimer.stop();
      totalTime +=(getTimer()-startTime)/1;
      yourTF.text = Math.round(totalTime).toString();
    }// add yourTF to the stage

    Hello, Thanks for the reply.
    I put the code onto frame 20 and added the gotoAndPlay (1), the code played, I then clicked the button which reset the playhead to frame 1 , however the code didn't play a second time ?
    Any idea why ?
    Thanks for your help.
    Mick
    myButton.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_2);
    function fl_ClickToGoToAndPlayFromFrame_2(event:MouseEvent):void
    gotoAndPlay(1);
    trace("btn_myButton");

  • Stopping audio and starting another audio when button clicked

    Hello,
    I have a multiple slide document, and I want sound to stop
    when they click the "Next" button, and another audio clip to start.
    Here is what I have so far:
    //audio
    x = new Sound();
    x.attachSound("Slide1");
    x.start(0, 0);
    musicplay = true;
    forward_btn.onRelease = function() {
    gotoAndStop("2");
    numbering eq numbering++;
    So I just want it to play audio clip "Slide2" when they click
    forward_btn, and I want "Slide1" to stop.
    Thanks!

    Attach your second sound file to the frame that will play the
    second sound. Then try adding stopAllSounds() before the
    gotoAndStop("2"); to get the first sound to stop playing and then
    play the second sound.

  • I am going to upgrade from leopard to snow leopard ( I just purchased the snow leopard disk today).  Will I be able to keep my data and third party programs after installation?

    Hi Apple Community,
    This is my first time using the Apple Support Communities.  After installing/upgrading to snow leopard from disk will I lose my data and my third party programs like Adobe Indesign?
    Thank you in advance,
    John

    John... welcome to ASC,
    You could if you don't backup everything to an external drive first. Always backup your important data before upgrading from one Mac OS to the next.
    "Backup"  most important word in computing 
    Make sure your Mac meets Snow Leopard's minimum requirements before upgrading >   Mac OS X v10.6 Snow Leopard - Technical Specifications

  • Cancelling one SwingWorker and starting another

    Hi,
    I have a SwingWorker that does something in the background. When the user presses a button, I want the old worker to get canceled and I want to start a new one. The old worker should do some clean up/logging and close.
    This is the code in my main dispatcher thread:
    public void keyTyped(KeyEvent e)
         if(_controlThread != null)
              _controlThread.cancel(true);
                    java.util.logging.Logger.getLogger("something").fine("output_here");
         _controlThread = new SwingWorker(...);
         _controlThread.execute();
    }The Swing Worker has
    if(this.isCancelled())
        Logger.getLogger("something").fine("closing");
        return;
    }The problem is that the new Worker never starts. Also I noticed that
    Logger.getLogger("something").fine("output_here");
    never logs, I wonder why that is.
    Anyone know what is going on here?
    Thanks

    While trying to reproduce my problem with SSCCE I found the problem.
    import java.awt.event.*;
    import java.util.concurrent.CancellationException;
    import java.util.concurrent.ExecutionException;
    import java.util.logging.*;
    import javax.swing.JFrame;
    import javax.swing.SwingWorker;
    import java.io.*;
    public class main
          * @param args
         public static void main(String[] args) throws IOException
              main a = new main();
              Manager b = a.new Manager();
         class Manager implements KeyListener
              private ControlThread _controlThread;
              Manager()
                   JFrame frame = new JFrame();
                   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                   frame.setVisible(true);
                   frame.addKeyListener(this);
                   frame.setSize(300,300);
              public void keyTyped(KeyEvent e)
                   if(_controlThread != null)
                        _controlThread.cancel(true);
                        System.out.println("cancelled thread");
                   _controlThread = new ControlThread();
                   _controlThread.execute();
              public void keyPressed(KeyEvent e){}
             public void keyReleased(KeyEvent e){}
         class ControlThread extends SwingWorker<Void, Void>
              public Void doInBackground()
                   System.out.println("I'm running");
                   try
                        //do some stuff
                        Thread.sleep(10000);
                   catch (InterruptedException ex)
                        System.out.println("I got cancelled");
                        return null;
                   System.out.println("I finished");
                   return null;
              public void done()
                   try
                        System.out.println("dd");
                        get();
                        System.out.println("ee");
                   catch(InterruptedException ie)
                        System.out.println(": Canceled in done()");
                   catch(ExecutionException ex)
                        System.out.println("Exception in ControlThread: done");
    }This code will fail with a CancellationException in done(). I never saw this exception because I was using loggers and didn't look at the console output. The solution is to catch the CancellationException in done(). The problem is that it is not-documented that get() can throw a CancellationException, because then eclipse would require me to catch it.
    Thanks for helping petes1234.

  • Start anothe program from PL/SQL

    Hello,
    I want to start a scanner via PL/SQL or APEX. How can I set a OS command?
    Regards
    Siegwin

    3 basic options:
    - external procedure (aka <i>ExtProc</i>)
    - using DBMS_SCHEDULER
    - Java stored proc
    For an extproc example see {message:id=2271919}.
    For a Java stored proc example see {message:id=1107330}.

Maybe you are looking for

  • VAT-Purchase Register - S_ALR_87012357 - displays no values

    Hello, I have a problem with the report S_ALR_87012357, because no values are displayed . I have invoices posted, but I don't know why when I'm running this report it shows no values. The documents are displayed here in this report without values. I

  • UPGRADE : RFC call to subst_save_upgeval_db failed with key UPDATE_ERROR

    Hello. We are upgrading our NW 7.01 to NW 7.3 ABAP. In Postprocessing phase MAIN_POSTP/CREATE_UPGEVAL we encounter the following error: ERROR: RFC of "subst_save_upgeval_db" failed key: ERROR UPDATE message: EXCEPTION UPDATE_ERROR RAISED Here is the

  • Can I set Mail default text color

    Is there a way to set default text color for sent messages?  These settings don't seem to have any effect:

  • Regarding special characters in XSLT

    hi , i am working on XSLT, as we know that XSLT does not support special characters we need to handle them. can anyone provide me with the entire list of characters that XSLT does not support. I had searched in google but could only find a few. thank

  • Files with broken links that only show in Smart Playlists

    Hello, My issue is a strange one, so please bear with me. First - I've had the same iTunes library for several version of iTunes. That might have something to do with my issue. The issue is that when I create a Smart Playlist filtering for genre=podc