×

Loading...
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。

tried it just now and I made it! just add step 3) nohup [pid];

本文发表在 rolia.net 枫下论坛----------------------------------------------------------------------
eagle_no1's comments:
I launched the process , loop , which runs forever untill it's killed.
and made it runing on background with command cntl-z; bg
on one terminal
----------------------------------------------------------------------
and do following steps the another terminal:

[s@localhost s]$ ps -aef | grep loop
s 2217 2191 0 19:12 pts/2 00:00:00 ./loop
s 2219 2111 0 19:13 pts/1 00:00:00 grep loop
[s@localhost s]$ nohup "2217"
nohup: appending output to `nohup.out'
[s@localhost s]$ ps -aef | grep loop
s 2217 2191 0 19:12 pts/2 00:00:00 ./loop
s 2223 2111 0 19:13 pts/1 00:00:00 grep loop
-----------------------------------------------------------------------
eagle_no1's comments:
here I close the terminal on which I launched the process loop and do follow step
on this terminal;
please notice the parrent's ID and tty name of process loop.
it's still there!!
------------------------------------------------------------------------
[s@localhost s]$ ps -aef | grep loop
s 2217 1 0 19:12 ? 00:00:00 ./loop
s 2225 2111 0 19:13 pts/1 00:00:00 grep loop更多精彩文章及讨论,请光临枫下论坛 rolia.net
Report

Replies, comments and Discussions:

  • 工作学习 / IT技术讨论 / SCO unix shell下面,能不能有什么方法把一个正在运行的程序变成台后不中断运行?(就是nohup xxxxx &)
    • There are so many good programmers in this forum. I dare not to say anything any longer. Keep waiting I am sure you will get an good solution. Or just check a command name d*
      • 恐怕等不住了:(,还有15分钟下班了,估计要把laptop开着放抽屉了,赫赫
    • should be no way. at leas i don't know any.
      • 我也不知道如何做,但也不知道有没有‘路’:)
    • 下次直接扔后台吧
      • I would use ^z ; bg in bash
        • stopped?
    • ctl-z; bg
      fg [jobId] ;
      if you want to make it front ground again
      • it is different between "nohup xxx &" and use CTRL-Z and bg.
        both case let the program run at background.
        the difference is when the shell, which create the the background process, die and the tty (or pts) is release , in first case, the application still run. But to second case, the application will die.

        That is based on there is no signal handler for HUP in the applicaion.

        nohup means no-HUP. HUP is a signal. When use terminal, if the terminal is turn off, or lines is broke, all the process in that terminal will receive signal HUP (hang up). By default, the process will die. You can setup the signal handler for sig HUP. The command nohup is for it.

        I had experience when I just switch program to background by using "CTRL-Z' and bg. Then later, somehow my terminal hang( not die yet, just no response), then all the process in that terminal(pts) hang for ever. Later when I try to run long-time program, i use nohup.
        • agree ! #1773765 #1774114 ; could you find the command to block the singal to the running process?
    • 晚了,晚了,都回到家了:P,下次知道用ctrl-z了,谢谢2位
      • 1)"ctrl-z" make the process suspend; 2) "bg"; resume it on the background; it's two steps actually;
        • when you log out, even background job will quit unless you put nohup.
          • 啊哦,看样子,不确定多久完成的,直接nohup掉了:(
            • then you got to stop it and restart with nohup xxx &, hehe. I usually use "at -f xxx now".
              • fxxx? 脏话!
                • 别想了,去看眼科吧,呵呵
                  那么大一个空格都看不到,你严重斗鸡眼啊
          • tried it just now and I made it! just add step 3) nohup [pid];
            本文发表在 rolia.net 枫下论坛----------------------------------------------------------------------
            eagle_no1's comments:
            I launched the process , loop , which runs forever untill it's killed.
            and made it runing on background with command cntl-z; bg
            on one terminal
            ----------------------------------------------------------------------
            and do following steps the another terminal:

            [s@localhost s]$ ps -aef | grep loop
            s 2217 2191 0 19:12 pts/2 00:00:00 ./loop
            s 2219 2111 0 19:13 pts/1 00:00:00 grep loop
            [s@localhost s]$ nohup "2217"
            nohup: appending output to `nohup.out'
            [s@localhost s]$ ps -aef | grep loop
            s 2217 2191 0 19:12 pts/2 00:00:00 ./loop
            s 2223 2111 0 19:13 pts/1 00:00:00 grep loop
            -----------------------------------------------------------------------
            eagle_no1's comments:
            here I close the terminal on which I launched the process loop and do follow step
            on this terminal;
            please notice the parrent's ID and tty name of process loop.
            it's still there!!
            ------------------------------------------------------------------------
            [s@localhost s]$ ps -aef | grep loop
            s 2217 1 0 19:12 ? 00:00:00 ./loop
            s 2225 2111 0 19:13 pts/1 00:00:00 grep loop更多精彩文章及讨论,请光临枫下论坛 rolia.net
            • what unix?
              • I tried it on linux, I beleave it works on sco unix also..
                • unfortunately, it's not the case.
                  • wait a moment ....
                    :-(( I tried it on soliras, it looks like not all unix (unix alike ) system support such command. but I feeling is that there should be some command like nohup, taking pid instead of process name , to block the ternimal signal...
                    who knows..
                    • do u have Solaris at home?
                      • I can connect to the company's network from home. btw, I didn't try "nohup -p [pid]" in the above post, thx for your info.
            • nohup pid is available to Solairs Unix but not for Linux. I'll check the nohup syntax on AIX tomorrow.
              http://bama.ua.edu/cgi-bin/man-cgi?nohup+1
              • it works on linux for sure. (#1774071
                • Yes. it works on Linux. But, the usage "nohup pid" is not in 'man nohup'.
    • 讨论这么激烈啊,好,好,好,今天我都试试:)