nohup vs screen -- 哪个更适合长时间运行的进程? [英] nohup vs screen -- which is better for long running process?

查看:54
本文介绍了nohup vs screen -- 哪个更适合长时间运行的进程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景:我有一个长时间运行的脚本,它使数据库架构更改具有我想在迁移后检查的输出.我想将其写入文件.

Background: I have a long running script that makes database schema changes that has output I would want to check after the migration. I would want to write this to a file.

我一直在阅读关于 nohup 和 screen 的堆栈溢出.这两种方法我都试过了,但都担心.

I have been reading stack overflow about nohup and screen. I have tried both and have concerns about both.

IN:如何将进程作为后台运行并且永不消亡?

他们说他们使用了 nohup 并且 putty 终止了这个进程.这怎么可能?我一直无法使用 Mac OS X 终端进行复制.

They said they used nohup and putty killed the process. How is this possible? I have been unable to replicate using Mac OS X terminal.

使用 screen 我害怕输入 exit 而不是 ctrl + a, d

With screen I am terrified of typing exit instead of ctrl + a, d

另外,如果我在使用 screen 时只是退出终端应用程序,它似乎保留了状态.

Also If I just quit the terminal app when using screen, it seems to preserve the state.

屏幕似乎是更好的解决方案,因为打开一堆屏幕并切换回状态真的很漂亮.

Screen seems to be the better solution because it is really nifty how you can have a bunch of them open and switch back to the state.

在我的情况下你会推荐什么?我还有一个月左右没有运行脚本(当我发布时).我应该更适应屏幕并坚持使用它吗?

What would you recommend in my situation? I don't have the run the script for another month or so (When I have a release). Should I become more comfortable with screen and just stick with that?

推荐答案

两者都有自己的 + 和 - :

Both have there own + and - :

nohup:

  1. nohup 非常适合在 proc 不运行时在后台运行 procs需要任何用户输入,如 httpd 服务器或任何其他服务器进程,如那.
  2. nohup 确实在 proc 执行的目录中创建日志.日志文件名默认为 nohup.out
  3. 避免proc被误杀ctrl+C , ctrl+D .只是一个安全卫士.
  4. 默认情况下,它通常使用基本设置进行安装.无需像屏幕一样单独安装.
  5. 它的功能非常特定于在后台运行作业和倾销输出.低内存密集型.

屏幕:

  1. 必须单独安装.您不能去数据中心或登录
    存在任何框和期望屏幕.
  2. 善于管理不同主题的多个终端并为其命名.
  3. 它更像是终端管理器,而不是像 nohup 这样无限时间运行 proc 的命令.
  4. 如果 proc 需要用户输入,则更合适.喜欢安装
    脚本,是/否提示.
  5. 随着功能的变化,它是记忆.但同意,有些功能确实很棒.

总而言之,两者都是以不同的议程制作的两种不同的东西,因此很难进行比较.

To conclude, both are two different things made with different agendas so comparison is difficult.

干杯!

这篇关于nohup vs screen -- 哪个更适合长时间运行的进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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