Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Question Trick program into running in foreground?

    I have this weird program: dns2tcpc (creates a dns tunnel). I would like it to run at startup. However, I found that the program doesn't work when backgrounded!

    EX: dns2tcpc -z -l 8888
    Works, and I can use SSH to port 8888.

    However, if I try to background it, like: dns2tcpc -z -l 8888 &
    Then trying to connect to SSH won't get any response

    Now, I know this is a bug in dns2tcpc, and I really don't feel like compiling it or anything (I may have to), so is there any way to "trick" an application into thinking it's running in the foreground (like typing the command from the terminal window)? (Bonus if no addition installation is required)

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Use the shell command fg [jobspec] where the optional jobspec argument would be the particular job that you want to run in the foreground. Normally you would not need a jobspec argument unless you started other background processes after the one you want to move to the foreground.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Thanks for the reply. Unfortunately, it didn't work. Nevertheless, I found the solution. It's pretty hacky, but it works:

    screen -dmS dnstunnel dns2tcpc -f /etc/dns2tcpc.conf
    It creates a screen session, launches the command, and detaches.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts