例如我这样让其放置后台
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
不到,同样的,程序是死循环 ,需要我手动才能关闭,我就测试退出进来它就关闭了,排除程序问题
There is a missing symbol after
: &
For example:
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.
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
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.
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.
Use ps -aux|grep xxx to find
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.
I use
setsid /usr/local/php/bin/php ~/shua3.php > /dev/null &