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. CentOS 7.5 (is reaching its end of life) Ubuntu 20 (for GPU usage) Ubuntu 22 By default, Linux VMs have no connection to the outside world, so cannot be directly ...
    • 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. 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 with y and press ...
    • CentOS Linux 7 is reaching its end of life

      In 2020, The CentOS Project, in coordination with Red Hat, announced that it would shift full investment to CentOS Stream, the upstream development platform for upcoming Red Hat Enterprise Linux releases. As a result, CentOS Linux 7 will reach the ...
    • 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 ...
    • Linux - Fix for mounting issues

      Linux Virtual Machines (VMs) created between December 2022 and 28 June 2023 are mounting far too many disks as a result of a bug in the mounting script. This bug may have led to unexpected side effects such as performance issues or sometimes being ...