#! /bin/sh # check_status cmd=$1 st=$2 if [ $st -eq 0 ]; then res="OK." else res="FAILED with exit code $st." fi # put result in the log file printf "%-20s $res\n" $cmd | tee -a $LOGDIR/status.log