2

I'm trying to run a console server application that needs xvfb-run to run in the background. It works but when I logged out of my session the whole process stops and I can't connect to my application anymore.

I already tried using nohup, & at the end, batch and still no luck with it. I'm using Ubuntu 14.04 LTS 64bit on a VPS service.

Any ideas?

scottyp
  • 295
  • 1
  • 4
  • 13
  • Run it inside a `screen` session? – Piskvor left the building Dec 19 '15 at 10:27
  • Thanks Poskvor. Apparently I'm not familiar on how to invoke screen properly with xvfb-run. Do you know how? – scottyp Dec 19 '15 at 10:37
  • http://superuser.com/a/454914/2249 where `yourcommand` would be `xvfb-run` – Piskvor left the building Dec 19 '15 at 10:39
  • use screen as @Piskvor or try to use a tmux session – rkachach Dec 19 '15 at 10:42
  • I tried the screen solution and I got a session but I can't connect even when I'm still logged in. I can see the list using screen -list but I can't connect to my application. I will try tmux next.. – scottyp Dec 19 '15 at 10:45
  • I have no idea how to exit when I run my app in tmux, I keep pressing "Ctrl+A, d" to detach to it once it started running but it doesn't work.. – scottyp Dec 19 '15 at 10:53
  • @redobot How do I exit out of tmux properly so my app is still running in the background? – scottyp Dec 19 '15 at 10:59
  • Just create a new session, run whatever you need and then detach from the session (Ctrl+D). Afterwards you can attach newly and resume your work. Take a look to the following link for the basic commands: https://robots.thoughtbot.com/a-tmux-crash-course – rkachach Dec 19 '15 at 11:01
  • This Q may be more appropriate on the related sites, either http://askubuntu.com or http://unix.stackexchange.com . Consider using the flag link at the bottom of your Q and ask the moderator to move it. Good luck. – shellter Dec 19 '15 at 11:07
  • Thanks but my program always stops when I add a **&** background command, if I don't do this I can't use Ctrl+D to detach. Any suggestions on how to place xvfb-run in the background? – scottyp Dec 19 '15 at 11:18
  • btw, my app uses UDP to listen to incoming clients. I hope this is related to my problem. – scottyp Dec 19 '15 at 11:26
  • Well, I guess we need more info about your app, because I've just tried `xvfb-run xterm ./test.sh & exit` on Ubuntu 14.04 and it works. – name_no Dec 19 '15 at 12:15
  • Hi, like I said above it's a custom server application that uses UDP connections. When I try running normally it works, if I make it as a background process with & at the end, CTRL+Z to stop and bg to continue my session exits and I logged out. – scottyp Dec 19 '15 at 12:35
  • @shellter ok I will try that as well, thanks! – scottyp Dec 19 '15 at 12:35
  • 1
    Having a second try at screen it works in some way. The only problem now is I'm getting a timeout error when I detach my session and exit. – scottyp Dec 19 '15 at 12:59
  • 1
    I got it to work now using screen and detach. Thanks guys! :) – scottyp Dec 19 '15 at 14:13

1 Answers1

0

Run it inside a screen session? – Piskvor

I got it to work now using screen and detach. Thanks guys! :) – scottyp

Armali
  • 18,255
  • 14
  • 57
  • 171