#!/usr/bin/bash ################################################################################### # Script name: msas # # This shell script run program and checks log # # example: # > msas -suffix ITT_C2 pgm.sas # Author: Sarwan Singh ################################################################################### start_hh=`expr $(date +%H) \* 1` start_mm=`expr $(date +%M) \* 1` start_ss=`expr $(date +%S) \* 1` start_tm=$(( $start_hh*3600+$start_mm*60+$start_ss*1 )) t=1 strchk=1 #if suffix is provided if [ "$1" = "-suffix" ]; then arg1=$2 rsas94 -suffix $2 $3 & while [ "$strchk" != "" ] do printf "%02d." $t ((t=t+1)) sleep 1 #print new line every 10 seconds ((nline=(t-1)%10)) if [ $nline = 0 ]; then printf "\n" fi strchk=`jobs` done progname=`echo $3 | awk -F"." '{print $1}'`_$2.sas logname=`echo $3 | awk -F"." '{print $1}'`_$2.log else rsas94 $1 & while [ "$strchk" != "" ] do printf "%02d." $t ((t=t+1)) sleep 1 #print new line every 10 seconds ((nline=(t-1)%10)) if [ $nline = 0 ]; then printf "\n" fi strchk=`jobs` done progname=`echo $1 | awk -F"." '{print $1}'`.sas logname=`echo $1 | awk -F"." '{print $1}'`.log fi printf "\n" check reports/${logname} #logScan reports/${logname}.log stop_hh=`expr $(date +%H) \* 1` stop_mm=`expr $(date +%M) \* 1` stop_ss=`expr $(date +%S) \* 1` stop_tm=$(( $stop_hh*3600+$stop_mm*60+$stop_ss*1 )) diff=$(( $stop_tm-$start_tm )) printf "\n\n" echo "******* Done: $progname **********" echo "******* Time Elapsed: $((diff/3600))h $((diff/60))m $((diff%60))s **********"