Ensuring Continuity for Long Linux Processes with Tmux

Ensuring Continuity for Long Linux Processes with Tmux

Introduction

Users might experience an issue when working with Linux Virtual Machines (VMs), especially when connecting through SSH using tools like Bastion or PowerShell. The problem arises when the connection to the VM is lost due to closing the browser tab, network issues, or any other interruption.

This behavior is particularly inconvenient for those running long scripts or processes that need to continue running in the background, for example, overnight.

Solution

Long running scripts/commands are vulnerable to being interrupted if your connection drops. It's recommended to execute these long running scripts/commands through a tool called tmux.

Tmux allows you to starts a terminal session that isn't coupled to your user, and as such will persist when you log out or lose connection.

To start a tmux session in your terminal use the following command:
'tmux new -s your_session_name'

Execute your long running script/commands in this tmux session. You can now exit the tmux session by closing the terminal/browser or by typing CTRL+B and then D.

You can resume your earlier tmux session with:
'tmux attach -t your_session_name'

    • Related Articles

    • Linux VMs

      On the myDRE platform different types of Linux virtual machines (VMs) are available. Ubuntu 20 (for GPU usage) Ubuntu 22 By default, Linux VMs have no connection to the outside world, so cannot be directly ssh'ed into like a Windows VM. Therefore a ...
    • Turn Proxy Off/On on Linux VM

      1. Log in to the Linux VM 2. Write command sudo nano /etc/environment press enter and enter your password 3. To turn Proxy Off, comment out all the content that you find in there e.g #http_proxy="http://127.0.0.1:8080" 4. Press ctrl + x to exit, save ...
    • Install Browser on Linux

      Introduction Until now, Linux users have primarily relied on the command line for their browser access. For effortless web browsing on your Linux virtual machine, a single click installation of Firefox is the optimal choice. We have considered ...
    • Low severity vulnerability in Linux VMs patch

      TL;DR: We have found a low severity vulnerability in Linux VMs. It has been patched for newly created VMs. Existing VMs can be self-service patched by downloading and running the script below. What happened? While troubleshooting a Linux VM, we ...
    • Expanding the (OS-)disk - Windows & Linux

      Why expand the OS-disk? In a Virtual Machine (VM), the OS-disk is where the Operating System (OS; for instance Windows or Linux) is installed but also encompasses your general desktop and other folders (basically anything on the C:-drive). It is ...