2

I have a program that runs on Ubuntu (14.04) whether I am in the terminal or not. This program relies on a vpn connection, for which I am using vpnc (cisco).

I have added vpnc to my reboot and start up processes, and my program works fine when I reboot (and soon thereafter log in to the terminal). But when I exit the terminal, I lose the vpn connection and the program throws an exception.

Can anyone help me figure out how to keep the vpn connection running even after I log out of the terminal?

2 Answers 2

1

You need to start vpnc using nohup. See this question.

For example to start command and to redirect its output to command.log use:

nohup command > command.log &

If you want to see the output use:

tail -f command.log
5
  • @user3079064 Thanks for the help, but for some reason this solution is not working with vpnc. The vpn keeps going down as soon as I exit the terminal. May 29, 2014 at 17:35
  • have you tried nohup /usr/sbin/vpnc config.conf &?
    – sergej
    May 29, 2014 at 17:45
  • Thank you for the follow-up. I am using sudo nohup vpnc & (and my config file is in a place that vpnc regularly checks). sudo vpnc works fine whenever I am logged into putty (even if I log back in later) but never when I am outside putty. May 29, 2014 at 18:07
  • What about nohup sudo vpnc &?
    – sergej
    May 29, 2014 at 19:03
  • Thanks again for the guidance, but that also produces the same result. May 29, 2014 at 19:15
1

Try with Byobu:

Byobu is a light, powerful, text-based window manager based on GNU Screen . Using Byobu, you can quickly create and move between different windows over a single SSH connection or TTY terminal, monitor dozens of important statistics about your system, detach and reattach to sessions later while your programs continue to run in the background.

Just open byobu

byobu

In this new terminal start vpnc or what you need

press F6 to detach from this session

If you need this session you just need to run byobu again with

byobu

This session will "survive" your logout :)

For more shortcuts see the link in the first line...

IMPORTANT:

Don't forget that if you want this session to stay active you must leave the session with F6

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .