EC2 ssh broken pipe terminates running process EC2 ssh broken pipe terminates running process unix unix

EC2 ssh broken pipe terminates running process


You should try screen.

Install

Ubuntu:

apt-get install screen

CentOS:

yum install screen

Usage

Start a new screen session by

$> screen

List all screen sessions you had created

$>screen -lsThere is a screen on:        23340.pts-0.2yourserver    (Detached)1 Socket in /var/run/screen/S-root.

Next, restore your screen

$> screen -R 23340$> screen -R <screen-id>


A simple solution is to send the process to the background by appending an ampersand & to your command:

nohup python myapplication.py > myprogram.out 2>myprogram.err &

The process will continue to run even if you close your SSH session. You can always check progress by grabbing the tail of your output files:

tail -n 20 myprogram.outtail -n 20 myprogram.err


I actually ended up fixing this accidentally with a router configuration, allowing all ICMP packets. I allowed all ICMP packets to diagnose a strange issue with some websites loading slowly randomly, and I noticed none of my SSH terminals died anymore.

I'm using a Ubiquiti EdgeRouter 4, so I followed this guide here https://community.ubnt.com/t5/EdgeRouter/EdgeRouter-GUI-Tutorial-Allow-ICMP-ping/td-p/1495130

Of course you'll have to follow your own router's unique instructions to allow ICMP through the firewall.