DEV Community


Posted on

How to Reconnect to Process logs on Ubuntu

Running continuous processes or functions on a virtual machine is essential for any large development process.

Here's how to continuously run a process on Ubuntu, disconnect and then reconnect to access a process' logs.

Step 1) Start screen

This might be already installed, check with: screen --version

If not, install with one of these commands (OS specific)

yum install screen
apt install screen

Open a screen session:


Screen User Manual

Step 2) Run your program with &

I'm running a validator in a GCP ubuntu virtual machine so my start command looks like:
sudo mortar server --data-dir ./data-dir --chain genesis.json --libp2p --nat IP-ADDRESS --seal --price-limit 1 &

Just make sure to add & to the end of whatever command you use. This is let the program to keep running even after you quit the shell session.

Step 3) Disconnect your SSH session

You can do this by closing the shell window

Step 4) Reconnect

Resume screen session: screen -r

You should now see the output of the process logs in real time

Top comments (0)