bash wait 명령어

Posted at 2009/02/11 11:15 // in Tips/Utility programs // by Daniel

bash 스크립트에서 백그라운드로 실행시키는 스크립트가 있을 때 그 스크립트의 종료를 기다려 처리하고 싶은 일이 있을 때가 있죠

그때 쓰는 게 wait입니다.

#!/bin/sh
./sort_db.sh &
echo "1st Line"
./bkptmp.sh &
echo "2dn line"
wait
echo "Some operation will follow this"

이런식으로 쓰면 됩니다. &로 백그라운드 실행한 스크립트를 기다려줍니다.

http://unstableme.blogspot.com/2008/06/bash-wait-command.html

Task contention상황에서 QoS를 위한 연구를 하는 중인데 스크립트로 돌리려니 이게 필요해서 찾아봤습니다.

크리에이티브 커먼즈 라이센스
Creative Commons License