You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
1.3 KiB
71 lines
1.3 KiB
#!/bin/bash
|
|
set -e
|
|
|
|
count=$(alias | grep -w grep | wc -l)
|
|
if [ "$count" -gt "0" ]; then
|
|
unalias grep
|
|
fi
|
|
count=$(alias | grep -w ls | wc -l)
|
|
if [ "$count" -gt "0" ]; then
|
|
unalias ls
|
|
fi
|
|
|
|
LOCAL_PWD=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
|
OSVERSION=$(uname)
|
|
ADMIN_USER=$(whoami)
|
|
ADMIN_HOME=$(eval echo ~$ADMIN_USER)
|
|
#GPFDIST_PORT=5000
|
|
MASTER_HOST=$(hostname | awk -F '.' '{print $1}')
|
|
|
|
init_log()
|
|
{
|
|
if [ -f $LOCAL_PWD/log/end_$1.log ]; then
|
|
exit 0
|
|
fi
|
|
|
|
logfile=rollout_$1.log
|
|
rm -f $LOCAL_PWD/log/$logfile
|
|
}
|
|
start_log()
|
|
{
|
|
if [ "$OSVERSION" == "Linux" ]; then
|
|
T="$(date +%s%N)"
|
|
else
|
|
T="$(date +%s)"
|
|
fi
|
|
}
|
|
log()
|
|
{
|
|
#duration
|
|
if [ "$OSVERSION" == "Linux" ]; then
|
|
T="$(($(date +%s%N)-T))"
|
|
# seconds
|
|
S="$((T/1000000000))"
|
|
# milliseconds
|
|
M="$((T/1000000))"
|
|
else
|
|
#must be OSX which doesn't have nano-seconds
|
|
T="$(($(date +%s)-T))"
|
|
S=$T
|
|
M=0
|
|
fi
|
|
|
|
#this is done for steps that don't have id values
|
|
if [ "$id" == "" ]; then
|
|
id="1"
|
|
else
|
|
id=$(basename $i | awk -F '.' '{print $1}')
|
|
fi
|
|
|
|
tuples=$1
|
|
if [ "$tuples" == "" ]; then
|
|
tuples="0"
|
|
fi
|
|
|
|
printf "$id|$schema_name.$table_name|$tuples|%02d:%02d:%02d.%03d\n" "$((S/3600%24))" "$((S/60%60))" "$((S%60))" "${M}" >> $LOCAL_PWD/log/$logfile
|
|
}
|
|
end_step()
|
|
{
|
|
local logfile=end_$1.log
|
|
touch $LOCAL_PWD/log/$logfile
|
|
}
|
|
|