check_exec_test.sh

来自「ncbi源码」· Shell 代码 · 共 70 行

SH
70
字号
#! /bin/sh# $Id: check_exec_test.sh,v 1000.0 2004/02/12 21:54:48 gouriano Exp $# Author:  Vladimir Ivanov, NCBI ############################################################################## Time-guard script to run test program from other scripts (shell).# ## Usage:#    check_exec_test.sh [-stdin] <cmd-line>##    -stdin   - option used when application from <cmd-line> attempt#               to read from std input (cgi applications for example).#    cmd-line - command line to execute.## Note:#    The <cmd-line> should be presented with one application with#    optional parameters only. Using scripts is not allowed here.##    The CHECK_TIMEOUT environment variable defines a "timeout" seconds#    to execute specified command line.By default timeout is 200 sec.##    For protect infinity execution <cmd-line>, this script terminate #    check process if it still executing after "timeout" seconds.#    Script return <cmd-line> exit code or value above 0 in case error#    to parent shell.############################################################################# Get parameterstimeout="${CHECK_TIMEOUT:-200}"script_dir=`dirname $0`script_dir=`(cd "$script_dir"; pwd)`# Reinforce timeoutulimit -t `expr $timeout + 5` > /dev/null 2>&1# Run commandif [ "X$1" = "X-stdin" ]; then  cat - > $0.stdin.$$  shift  $@ < $0.stdin.$$ &  rm $0.stdin.$$ > /dev/null 2>&1else  "$@" &fipid=$!trap 'kill $pid; rm $0.stdin.$$ > /dev/null 2>&1' 1 2 15# Execute time-guard$script_dir/check_exec_guard.sh $timeout $pid &# Wait ending of executionwait $pid > /dev/null 2>&1status=$?# Return test exit codeexit $status# #  ===========================================================================#  PRODUCTION $Log: check_exec_test.sh,v $#  PRODUCTION Revision 1000.0  2004/02/12 21:54:48  gouriano#  PRODUCTION PRODUCTION: IMPORTED [CORE_001] Dev-tree R1.5#  PRODUCTION#  ===========================================================================# 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?