문제

nohup php /home/www/api/24 > 24.out 2> 24.err < /dev/null
nohup php /home/www/api/27 > 27.out 2> 27.err < /dev/null
nohup php /home/www/api/19 > 27.out 2> 16.err < /dev/null

I have a few thousand api calls I need to make and need to be done one by one so I don't flood the other server with web calls. After I run the sh file, how can I close the terminal without interrupting the process, CTRL+Z ?

도움이 되었습니까?

해결책

You type...

$ screen

...and hit enter.

Run the command or script.

Press control-a, then d

Then you can disconnect, log out, do whatever... come back later and check on the script:

$ screen -r

Then you wonder how you ever got along without it.

https://www.gnu.org/software/screen/

다른 팁

Put everything in a script, and then run that script with nohup:

#!/bin/bash
for i in 24 27 19 ...
do
    php /home/www/api/$i > $i.out 2> $i.err
done

Then do:

nohup /path/to/script </dev/null >/dev/null 2>&1 &

You could also use the batch(1) command with a here document, e.g:

 batch << EOJ
   php /home/www/api/24 > 24.out 2> 24.err < /dev/null
   php /home/www/api/17 > 17.out 2> 17.err < /dev/null
   php /home/www/api/19 > 19.out 2> 19.err < /dev/null
 EOJ
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top