declare -a tables=('click_user_sessions' 'user_ip_activity');
for i in "${tables[@]}"
do
table_name=$i
TABLE_NAME=`echo $table_name | tr '[a-z]' '[A-Z]'`
## Cleanup existing data
echo -e "\t-> Remove any existing Elastic search config"
curl -s -X "DELETE" "http://$ELASTIC_HOST:9200/""$table_name" >>/tmp/log.txt 2>&1
done
/run
Library
function get_hiveserver_uri() {
local base_connect_string="jdbc:hive2://localhost:10000"
if [[ "${KERBEROS_ENABLED}" == 'true' ]]; then
local hive_principal
hive_principal=$(get_hive_principal)
echo "${base_connect_string}/;principal=${hive_principal}"
else
echo "${base_connect_string}"
fi
}
cat command
cat <<EOF >hive-template.xml
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://localhost:${METASTORE_PROXY_PORT}/${METASTORE_DB}</value>
<description>the URL of the MySQL database</description>
</property>
...
</configuration>
EOF
for u in 0660:rw-rw---- \
0640:rw-r----- \
0600:rw------- \
0666:rw-rw-rw- \
0664:rw-rw-r--
do
x=$(expr "$u" : ".*:\([rw-]*\)") &&
y=$(echo "$x" | sed -e "s/w/-/g") &&
u=$(expr "$u" : "\([0-7]*\)") &&
git config core.sharedrepository "$u" &&
umask 0277 &&
history
Ctrl + R - Recursive command search
$ history
clear
echo "hello"
history
# Replay above three commands by !3
# Which tells 3rd line to run
!3
$ history | grep hello
3 echo "hello"
5 history | grep hello
# For timestamp
HISTTIMEFORMAT="%d/%m/%y %T " # for e.g. “29/02/99 23:59:59”
HISTTIMEFORMAT="%F %T " # for e.g. “1999-02-29 23:59:59”