zoukankan      html  css  js  c++  java
  • Linux后台运行程序(&和nohup)

    &

    后台运行程序

    使用ctrl+c发送SIGINT信号,程序不关闭
    关闭session/终端时发送SIGHUP信号,程序关闭

    示例:

    storm nimbus &

    程序运行的信息会输出到终端


    nohup

    不挂断(no hang up)运行程序

    使用ctrl+c发送SIGINT信号,程序关闭
    关闭session/终端时发送SIGHUP信号,程序不关闭

    示例:

    nohup storm nimbus

    程序运行的信息会默认输出到nohup.out

    也可以指定输出文件

    nohup storm nimbus > output.log 2>&1

    其中,2>&1的作用是,将标准错误2重定向到标准输出&1,再被重定向输入到output.log文件中。

    0 – stdin (standard input,标准输入)
    1 – stdout (standard output,标准输出)
    2 – stderr (standard error,标准错误输出)

    * 二者同时使用,可以使后台程序不受ctrl+c和session/终端关闭的影响。

  • 相关阅读:
    linux文件系统
    用户态和内核态
    nginx优化
    平滑升级nginx
    网络--基本概念
    haproxy
    awk
    kvm
    lvs
    自定义不等高cell—storyBoard或xib自定义不等高cell
  • 原文地址:https://www.cnblogs.com/live41/p/15554700.html
Copyright © 2011-2022 走看看