How to run program in background using Byobu

When running a training program, that might take hours to complete, I like to run it in the background. However, it should keep running even if I kill my current shell. I should be able to bring it back to the foreground and check its console output and then send it back to background. I should be able to do this any number of times.

The solution that fulfilled these requirements was to run the program in a new Byobu session. This is how I do it:

  • From my current shell, I launch a new Byobu session and start the program I want to run from its shell:
$ byobu
$ ./my-program
  • To detach from this Byobu session, just press Ctrl+a followed by d.

  • To re-attach to the Byobu session and check the progress of my program, invoke Byobu again from any terminal or shell.

The advantage of this setup is that Byobu is not the child of my shell, but rather of the desktop lightdm process. So, it will keep running even if my terminal is hung or killed. It also enables me to see the console output of the program anytime I want.

Tried with: Byobu 5.74, TMux 1.8 and Ubuntu 14.04

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s