Linux后臺進程
時間:2018-09-28 來源(yuan):未知
一(yi)、使用(yong)兩種方(fang)法(fa)在后臺運行(xing) ping 127.0.0.1,并把(ba) STDOUT 輸(shu)出到(dao) /tmp/stdout,把(ba) STDERR 輸(shu)出到(dao) /tmp/stderr
# 用戶退(tui)出服務器后程序就(jiu)停(ting)止了
ping 127.0.0.1 >> /tmp/stdout 2> /tmp/stderr &
# nuhop 就(jiu)是(shi)不掛起的意思,這樣當你用戶(hu)退出服務器(qi)后,程(cheng)序還(huan)會運行
nohup ping 127.0.0.1 >> tmp/stdout 2> /tmp/stderr &
# 打開文件查看
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.049 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.054 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.054 ms
64 bytes from 127.0.0.1: icmp_seq=4 ttl=64 time=0.054 ms
64 bytes from 127.0.0.1: icmp_seq=5 ttl=64 time=0.055 ms

