Score:0

How to keep a program running after log-out with x2go?

us flag

I have to run some programs on a shared workstation with x2go.

These programs take quite some time and I wish to:

  1. Start the program within x2go
  2. Log out
  3. Connect again after some time to the machine with x2go and see the results of the program

So, in the end, what I would like to do is similar to what one can do with screen. However, it seems that logging out kills all the programs running.

The programs use Mathematica and in particular some of its dynamic built-in functions, so I need access to the X-server in order to interact with the GUI and screen is not an option.

If needed, both my computer and the workstation use Ubuntu. The command cat /etc/os-release give:

My computer

NAME="Ubuntu"
VERSION="20.04.6 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.6 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

Workstation

PRETTY_NAME="Ubuntu 22.04.2 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.2 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
Score:0
cn flag

It cannot be done the way you propose:

As you have discovered when a GUI session ends, the display server is terminated (not suspended or hidden), and all child jobs are also terminated. That behavior is fundamental to logout.

Even if you did something fancy (like nohup) to keep your window alive, it would promptly error since there's no display anymore.

Developers facing this situation generally build two programs that talk to each other: One that doesn't require a display, and thus can persist using a terminal multiplexor (screen, tmux) or simply as a systemd service, cronjob, atjob, etc. And a second program that provides the intermittent graphical interface to the longer-running headless job.

You seem to have two alternatives: Keep your GUI session alive until completion, or rewrite your code to not require a display at all times.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.