例如我这样让其放置后台
nohup php index.php &
然后 jobs
jobs
[3] - running nohup /home/pubsrv/php-5.6.15/bin/php ~/tools/douban/localBanBrush.php 2>&1
[4] + running nohup /home/pubsrv/php-5.6.15/bin/php ~/tools/douban/localBanBrush.php 2>&1
现在都还在,可是我退出终端后 ,下次登录可就没了。。
没了: 进程号木有,直接ps
不到,同样的,程序是死循环 ,需要我手动才能关闭,我就测试退出进来它就关闭了,排除程序问题
阿神2017-04-17 17:12:38
There is a missing symbol after
: &
For example:
nohup sh /usr/local/services_data/elasticsearch-head.sh > /dev/null 2>&1 &
After running the nohup command, click Auto to see if the program can run in the background. If it doesn't work, there will be a pop-up message, just like yours.
PHP中文网2017-04-17 17:12:38
The standard output of the process defaults to the current session. If the session is closed, an error will occur. Standard output should be redirected to /dev/null
大家讲道理2017-04-17 17:12:38
1. You can use the process number to check whether the suspended process really exited.
2. If it exited, you need to check your program log to see where your program exited.
大家讲道理2017-04-17 17:12:38
cat nohup.out Take a look. If there is no such file, it means you closed the terminal before nohup finished running. Of course not.
伊谢尔伦2017-04-17 17:12:38
I have encountered this before. It is related to the SSH terminal you are using. You can try it by changing to the original bash.