check_exec_guard.sh

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

SH
57 行
字号
#! /bin/sh# $Id: check_exec_guard.sh,v 1000.1 2004/02/12 21:52:32 gouriano Exp $# Author:  Vladimir Ivanov, NCBI ############################################################################## Auxiliary time-guard script for run check command script## Usage:#    check_exec_guard.sh <timeout> <pid>##    timeout - maximal time of execution process with "pid" in seconds# # Note:#    If process with "pid" still execute after "timeout" seconds, that #    it will be killed and exit code from this script will be 1. #    Otherwise exit code 0 will be returned to parent shell.############################################################################# Parameterstimeout=$1pid=$2sleep_time=5# Wait while [ $timeout -gt 0 ]; do  kill -0 $pid > /dev/null 2>&1  ||  exit 0  if [ $timeout -lt  $sleep_time ]; then    sleep_time=$timeout  fi  timeout="`expr $timeout - $sleep_time`"  sleep $sleep_timedone# Time out, kill the processechoecho "Maximum execution time of $1 seconds is exceeded"echokill $pid > /dev/null 2>&1sleep $sleep_timekill -9 $pid > /dev/null 2>&1exit 1# #  ===========================================================================#  PRODUCTION $Log: check_exec_guard.sh,v $#  PRODUCTION Revision 1000.1  2004/02/12 21:52:32  gouriano#  PRODUCTION PRODUCTION: UPGRADED [CORE_001] Dev-tree R1.7#  PRODUCTION#  ===========================================================================# 

⌨️ 快捷键说明

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