如何在不保持ssh管道打开的情况下在Amazon EC2上运行脚本? [英] How to run script on Amazon EC2 without keeping an ssh pipe open?

查看:67
本文介绍了如何在不保持ssh管道打开的情况下在Amazon EC2上运行脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个脚本可以将历史数据记录到Amazon Redshift实例中.该脚本可能需要运行很长时间,可能要花24个小时才能运行完成.

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.

我尝试将ssh-sing到EC2实例中并从那里运行脚本,但是几个小时后,我离开笔记本电脑或关闭盖子,管道破裂,在脚本运行完成之前将其停止.

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.

如何使脚本在我的EC2上运行,而不必担心它会过早停止执行?

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

推荐答案

nohup yourshellcommandhere  &

将在后台运行,并且不需要您激活交互式ssh会话.

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

这篇关于如何在不保持ssh管道打开的情况下在Amazon EC2上运行脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆