Linux
CentOS 5.x - timeout 사용하기
광장군
2012. 6. 5. 18:57
[CentOS 5.x - timeout 사용하기]
CentOS 5.x 에는 timeout이 포함되어 있는 coreutils 패키지가 5.x 까지만 포함됨
timeout 과 유사한 기능을 shell 로 만들거나 다른 프로그램을 사용 할 수 있지만,
꼭 timeout 만 써야겠다 할 경우
gnu에서 coreutils 최신 소스 받아서 컴파일 해서 사용하면 됨
# mkdir /root/tmp
# cd /root/tmp
# yum install xz.x86_64
# wget http://ftp.gnu.org/gnu/coreutils/coreutils-8.14.tar.xz
# xz -d coreutils-8.14.tar.xz
# tar xvf coreutils-8.14.tar
# cd coreutils-8.14
# ./configure --prefix=/root/tmp
# make
# make install
# mv /root/tmp/bin/timeout /usr/bin/
# cd /root
# rm -fr /root/tmp
# timeout 1 sleep 2 && echo "bingo"
# timeout 3 sleep 2 && echo "bingo"
bingo
#