Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run script on Amazon EC2 without keeping an ssh pipe open?

I have a script built to log historical data into an Amazon Redshift instance. The script will likely need to run for a very long time, perhaps over 24 hours before it can run to completion.

I have tried ssh-ing into my EC2 instance and running the script from there, however the after a few hours I leave my laptop or shut the lid and the pipe is broken, stopping the script before it runs to completion.

How can I get a script running on my EC2, and then never have to worry about it stopping execution prematurely?

like image 576
johncorser Avatar asked Oct 16 '25 17:10

johncorser


1 Answers

nohup yourshellcommandhere  &

Will run in the background and not require you to have an interactive ssh session active.

like image 164
aframe Avatar answered Oct 18 '25 09:10

aframe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!