check_exec.sh
来自「ncbi源码」· Shell 代码 · 共 76 行
SH
76 行
#! /bin/sh# $Id: check_exec.sh,v 1000.3 2004/02/12 21:52:26 gouriano Exp $# Author: Vladimir Ivanov, NCBI ############################################################################## Execute check command## Usage:# check_exec.sh <cmd-line>## Note:# The <cmd-line> can contains any program or scripts.## 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)`# Make timestamptimestamp_file="/tmp/check_exec_timestamp.$$"touch timestamp_file# Reinforce timeoutulimit -t `expr $timeout + 5` > /dev/null 2>&1# Run command"$@" &pid=$!trap 'kill $pid' 1 2 15# Execute time-guard$script_dir/check_exec_guard.sh $timeout $pid &# Wait ending of executionwait $pid > /dev/null 2>&1status=$?# Special check for core file on Darwinif [ $status != 0 -a `uname -s` = "Darwin" -a -d "/cores" ]; then core_files=`find /cores/core.* -newer timestamp_file 2>/dev/null` for core in $core_files ; do if [ -O "$core" ]; then # Move the core file to current directory with name "core" mv $core ./core > /dev/null 2>&1 # Save only last core file # break fi donefirm timestamp_file > /dev/null 2>&1# Return test exit codeexit $status# # ===========================================================================# PRODUCTION $Log: check_exec.sh,v $# PRODUCTION Revision 1000.3 2004/02/12 21:52:26 gouriano# PRODUCTION PRODUCTION: UPGRADED [CORE_001] Dev-tree R1.21# PRODUCTION# ===========================================================================#
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?