快轉到主要內容

將腳本丟到背景執行

·58 字·1 分鐘·
PolloChang
作者
PolloChang
我是一隻雞
1
2
3
4
5
6
7
8
# 將腳本丟到背景執行,會輸出背景執行 PID Number
nohup /usr/local/bin/example-shell.sh &

# 監控結果
tail -f nohup.out

# 監控背景程序還有執行
watch -n 1 "ps -p 120448 -o pid,ppid,%cpu,%mem,cmd"