偵測背景執行結束 - Linux

Brianna avatar
By Brianna
at 2011-12-29T00:12

Table of Contents

我有個shell script 裡面執行了三個程式在背景執行
.......

program1 &
program2 &
program3 &

.......
想請問板上的各位高手,由於我接下來的動作,需要抓取
此三個程式結束所產生的檔案再進行處理,有沒有什麼方法
可以偵測到這些背景執行的程式已經結束了呢?

麻煩大家給點方法和提示! 謝謝~

--
Tags: Linux

All Comments

Yuri avatar
By Yuri
at 2012-01-01T17:51
man wait? 雖然我也不會,不過看起來是這個
Megan avatar
By Megan
at 2012-01-03T13:22
試試看這樣:
./program1 &
wait $!; ./postporcess
Sarah avatar
By Sarah
at 2012-01-03T21:37
由於你一次要等3個process,用C寫一個負責fork/exec/wait的
Isla avatar
By Isla
at 2012-01-08T13:12
小程式是最簡單的. 如果C或這部分的system call不熟,那就
在shell中用ps和grep定期檢查3個child process的pid是否仍
Rosalind avatar
By Rosalind
at 2012-01-11T02:38
在,只要任一個在,就sleep然後迴圈再檢查
Agatha avatar
By Agatha
at 2012-01-14T04:10
感謝以上高手們的提示,我去試試看~
Sarah avatar
By Sarah
at 2012-01-18T10:50
一次等3個process用xargs會比較好...
Elma avatar
By Elma
at 2012-01-23T07:23
echo 'p1\np2\np3'|xargs -d \\n -n 1 -P 3 -i
bash -c {} &

AIX There is not enough memory availabl

Wallis avatar
By Wallis
at 2011-12-29T00:03
請問一下,我在 AIX 上跑一些程式,結果不久後出現: The fork function failed. There is not enough memory available. 查了一下,是因為 PAGE SIZE 不足所致,不過這個訊息出現後,完全無法下指令了… 連 and#34;lsand ...

ubuntu 灌PCMANX時

Charlotte avatar
By Charlotte
at 2011-12-28T23:53
今天剛把 UAO 貼上的部份實作上去 如果是 Ubuntu 10.04/10.10/11.04/11.10/12.04 的使用者 可試試看 https://launchpad.net/~fourdollars/+archive/pcmanx/+packages 另外因為最近 SCM 在搬家從 Subversi ...

ubuntu 灌PCMANX時

Olive avatar
By Olive
at 2011-12-28T23:14
※ 引述《nightkid (Enuma-Elish)》之銘言: : 我是使用deb灌的(ubuntu 11.10) : sudo dpkg -i pcmanx-mls-gtk2_0.3.9-1_amd64.deb : dpkg:在處理 pcmanx-mls-gtk2_0.3.9-1_amd64.deb (- ...

更改ip之後連不到

David avatar
By David
at 2011-12-28T22:21
※ 引述《backfish (121)》之銘言: : 系統是freebsd : 我用putty遠端線到伺服器去修改了ip, : 然後/etc/networkstart,putty連線就斷了。 : 接著我用剛設定的ip去連線,卻連不伺服器了, : 請問這是什麼原因呢? : (伺服器是在客戶家,我不好意思打電話去 ...

關於使用者權限問題詢問一下

Irma avatar
By Irma
at 2011-12-28T20:59
小弟入行Linux這領域還沒過半年 最近學到了使用者權限問題 可是對於這部分有一些問題 想要請問一些問題 2.aptitude這個更新資料庫是否能給Root以外的使用者使用? 如果可以該以怎麼樣的指令進行新增使用者並且新增出可以允許這個群組的使用者 進行使用? 3.請問該以怎麼樣的指令來新增出比 ...