Distributions
› Ubuntu
› Fedora
› CentOS
中文资源站
› 网易开源镜像站
DongDongXie
V2EX  ›  Linux

关于 Linux nohup 指令

  •  
  •   DongDongXie · Oct 8, 2018 · 5512 views
    This topic created in 2949 days ago, the information mentioned may be changed or developed.

    RT, 我用 nohup 执行了一个 pig 脚本,jobs -l 可以看到我的后台执行任务,然后关掉了终端,当我再次打开终端的时候,jobs -l 就看不到这个任务了,请问怎么才能看到这个后台任务呢?

    23 replies  •  2018-10-09 21:33:40 +08:00
    feather12315
    feather12315
    Oct 8, 2018 via Android
    1
    htop
    whoami9894
    whoami9894
    Oct 9, 2018 via Android
    2
    我记得非正常关闭 session 会导致 nohup 退出,有时是关闭 ssh 就会退出。我之后用 screen 替代 nohup
    designer
    designer
    Oct 9, 2018 via iPhone
    3
    screen 感觉比较好!
    Nitroethane
    Nitroethane
    Oct 9, 2018 via Android
    4
    ps -ef
    helloworld12
    helloworld12
    Oct 9, 2018❤️1
    5
    nohup ./xxxx &
    Daihao18
    Daihao18
    Oct 9, 2018
    6
    ps -ef | grep xxxx
    xxxx 是你执行的脚本名字
    还有 jobs 那个是只对当前终端有效
    Cu635
    Cu635
    Oct 9, 2018
    7
    现在应该用 screen 或者 tmux 了。
    ysc3839
    ysc3839
    Oct 9, 2018 via Android
    8
    如果要后台运行程序的话建议使用 screen 或 tmux。
    cxbig
    cxbig
    Oct 9, 2018 via iPhone
    9
    tmux +1
    GG668v26Fd55CP5W
    GG668v26Fd55CP5W
    Oct 9, 2018 via iPhone
    10
    screen +1
    cpdyj0
    cpdyj0
    Oct 9, 2018
    11
    screen + 1
    Removable
    Removable
    Oct 9, 2018 via iPhone
    12
    用了 screen 以后发现比 nohup 好用太多了
    des
    des
    Oct 9, 2018 via Android
    13
    没人说 disown ??
    假如你跑了个程序,突然想放后台,总不能关了重跑吧?
    wjidea
    wjidea
    Oct 9, 2018
    14
    试试看 nohub nice pig &
    kyrre
    kyrre
    Oct 9, 2018
    15
    tmux 你值得拥有
    jorneyr
    jorneyr
    Oct 9, 2018
    17
    终端不要直接关闭,要用 exit 命令退出
    Mithrandir
    Mithrandir
    Oct 9, 2018
    18
    jobs 只会列出当前 shell 的 job,你说的这种情况你可以使用 ps aus 来查看这个后台进程
    yujincheng08
    yujincheng08
    Oct 9, 2018
    19
    tmux + 1
    reticentfat
    reticentfat
    Oct 9, 2018
    20
    screen +1
    kernel
    kernel
    Oct 9, 2018
    21
    systemd 时代何不用 systemd-run
    DongDongXie
    DongDongXie
    OP
    Oct 9, 2018
    22
    @ysc3839 学到了!
    DongDongXie
    DongDongXie
    OP
    Oct 9, 2018
    23
    @jasonyang9 谢谢,刚入门呢
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1384 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 53ms · UTC 20:18 · PVG 04:18 · LAX 12:18 · JFK 15:18
    ♥ Do have faith in what you're doing.