Changeset 26599e2


Ignore:
Timestamp:
09/09/13 11:33:55 (16 months ago)
Author:
Kris Moore <kris@…>
Branches:
master, 9.2-release, releng/10.0, releng/10.0.1, releng/10.0.2, releng/10.0.3, releng/10.1
Children:
59f367e
Parents:
e4d9ea3
Message:

Add rc_halt_s() function. Runs a shell command silently and only halts
/ displays when it fails

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src-sh/libsh/functions.sh

    r3d7cbf4 r26599e2  
    666666  fi 
    667667} 
     668 
     669# Run-command silently, only display / halt if command exits with non-0 
     670rc_halt_s() 
     671{ 
     672  CMD="$@" 
     673 
     674  if [ -z "${CMD}" ] ; then 
     675    exit_err "Error: missing argument in rc_halt()" 
     676  fi 
     677 
     678  TMPRCLOG=`mktemp /tmp/.rc_halt.XXXXXX` 
     679  ${CMD} >${TMPRCLOG} 2>${TMPRCLOG} 
     680  STATUS=$? 
     681  if [ ${STATUS} -ne 0 ] ; then 
     682    cat ${TMPRCLOG} 
     683    rm ${TMPRCLOG} 
     684    exit_err "Error ${STATUS}: ${CMD}" 
     685  fi 
     686  rm ${TMPRCLOG} 
     687} 
Note: See TracChangeset for help on using the changeset viewer.