New Script Wrapper

 

#!/bin/bash

date +%Y%m%d%H%M%S’

####################################
####################################

Start of Start Script

####################################
####################################
clear; APPL=$1
echo “APPL :” ${APPL} “:” $APPL “:”
echo “\$1 is :” $1 “:”

st_DT=date +%Y%m%d%H%M%S
echo “Started @ :” ${st_DT} “:”

####################################
####################################

End of Start Script

####################################
####################################

Run AAPL

####################################
####################################

Start of the End Script

####################################
####################################

set -x
if [ $1 ]
then
#    echo “\$1 is set to :” $1
sleep $1
else
#    echo “\$1 is not set”
sleep 12
fi
set +x

en_DT=date +%Y%m%d%H%M%S
echo “Ended   @ :” ${en_DT} “:”
echo -e “Started @ :” ${st_DT} “: \t\tEnded @ :” ${en_DT} “:”

echo -e “\n\n\n\n\nTime Start to End in SECs :” expr ${en_DT} - ${st_DT} “seconds”
st_YY=echo ${st_DT} | cut -c1-4
st_mm=echo ${st_DT} | cut -c5-6
st_dd=echo ${st_DT} | cut -c7-8
st_HH=echo ${st_DT} | cut -c9-10
st_MM=echo ${st_DT} | cut -c11-12
st_SS=echo ${st_DT} | cut -c13-14

en_YY=echo ${en_DT} | cut -c1-4
en_mm=echo ${en_DT} | cut -c5-6
en_dd=echo ${en_DT} | cut -c7-8
en_HH=echo ${en_DT} | cut -c9-10
en_MM=echo ${en_DT} | cut -c11-12
en_SS=echo ${en_DT} | cut -c13-14

diff_YY=expr ${en_YY} - ${st_YY}
diff_mm=expr ${en_mm} - ${st_mm}
diff_dd=expr ${en_dd} - ${st_dd}
diff_SS=expr ${en_SS} - ${st_SS}
diff_MM=expr ${en_MM} - ${st_MM}
diff_HH=expr ${en_HH} - ${st_HH}

This is not possible for Year YYYY variable

if [ ${diff_YY} -lt 0 ]

then

##     diff_YY=expr ${diff_YY} + 60

fi

if [ ${diff_mm} -lt 0 ]
then
diff_mm=expr ${diff_mm} + 12
fi

if [ ${diff_dd} -lt 0 ]
then
diff_dd=expr ${diff_dd} + 30 # This is not going to be accurate
fi

if [ ${diff_HH} -lt 0 ]
then
diff_HH=expr ${diff_HH} + 60
fi

if [ ${diff_MM} -lt 0 ]
then
diff_MM=expr ${diff_MM} + 60
diff_HH=expr ${diff_HH} - 1
fi

if [ ${diff_SS} -lt 0 ]
then
diff_SS=expr ${diff_SS} + 60
diff_MM=expr ${diff_MM} - 1
fi

echo “:” ${diff_HH} “:” ${diff_MM} “:” ${diff_SS} “:”

echo -e “\n\n\n\n\nTime Start to End in SECs :” expr \( ${diff_HH} \* 60 \* 60 \) + \( ${diff_MM} \* 60 \) + ${diff_SS} “seconds”

echo -e “\n\n\n\n\nTime Start to End:” ${StEn_Str}

####################################
####################################

End of the End Script

####################################
####################################

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s