1 |
#!/bin/bash --norc |
#!/bin/bash --norc |
2 |
THISDIR=`pwd` |
THISDIR=`pwd` |
3 |
USERNAME="" |
USERNAME=${PAM_DBUSER} |
4 |
HOST="" |
HOST="" |
5 |
DBNAME="" |
DBNAME="" |
6 |
PASSWORD="" |
COUNT=0;for word in `echo ${PAM_DBHOST} | tr [\/] [" "] |sed 's/mysql://g' `; do if [ $COUNT -eq 0 ]; then HOST=`echo $word`; fi; if [ $COUNT -eq 1 ]; then DBNAME=`echo $word`; fi; let COUNT=$COUNT+1; done |
7 |
if [ $# -gt 0 ] && [ $# -le 4 ]; then |
PASSWORD=${PAM_DBPSW} |
8 |
|
if [ $# -gt 0 ]; then |
9 |
I=1 |
I=1 |
10 |
while [ $I -le $# ]; do |
while [ $I -le $# ]; do |
11 |
if [ $I -eq 1 ]; then |
if [ $I -eq 1 ]; then |
53 |
let I=$I+1 |
let I=$I+1 |
54 |
done |
done |
55 |
else |
else |
56 |
echo "" |
if [ "$USERNAME" == "" ] || [ "$HOST" == "" ] || [ "$DBNAME" == "" ]; then |
57 |
echo " Usage: ./install_GL_PARAM.sh [options] " |
echo "" |
58 |
echo "" |
echo " Usage: ./install_GL_PARAM.sh [options] " |
59 |
echo " Options: " |
echo "" |
60 |
echo "" |
echo " Options: " |
61 |
echo " --user=username : MySQL username. " |
echo "" |
62 |
echo "" |
echo " --user=username : MySQL username. " |
63 |
echo " --host=mysql://localhost/pamelaprod : MySQL host and DB name." |
echo "" |
64 |
echo "" |
echo " --host=mysql://localhost/pamelaprod : MySQL host and DB name." |
65 |
echo " --psw=password : MySQL password" |
echo "" |
66 |
echo "" |
echo " --psw=password : MySQL password" |
67 |
exit 0 |
echo "" |
68 |
|
exit 0 |
69 |
|
fi |
70 |
fi; |
fi; |
71 |
|
echo "" |
72 |
|
echo " Updating GL_PARAM table on DB $DBNAME, $HOST with user $USERNAME and password $PASSWORD " |
73 |
|
echo " (you have 30 seconds to stop me using CTRL+c) " |
74 |
|
echo "" |
75 |
|
sleep 30; |
76 |
|
echo " Updating GL_PARAM table" |
77 |
# |
# |
78 |
rm -rf ${THISDIR}/temp.sql |
rm -rf ${THISDIR}/temp.sql |
79 |
PAM_CALIB2=$(echo $PAM_CALIB | sed 's/\//\\\//g') |
PAM_CALIB2=$(echo $PAM_CALIB | sed 's/\//\\\//g') |
84 |
cat ${THISDIR}/install_GL_PARAM.sql | sed 's/fullpathgoesere/'${PAM_CALIB2}'/g' >> ${THISDIR}/temp.sql |
cat ${THISDIR}/install_GL_PARAM.sql | sed 's/fullpathgoesere/'${PAM_CALIB2}'/g' >> ${THISDIR}/temp.sql |
85 |
mysql --user=$USERNAME --password=$PASSWORD --host=$HOST $DBNAME < ${THISDIR}/temp.sql |
mysql --user=$USERNAME --password=$PASSWORD --host=$HOST $DBNAME < ${THISDIR}/temp.sql |
86 |
# |
# |
87 |
|
echo " done! " |
88 |
echo "" |
echo "" |
89 |
echo "GL_PARAM TABLE NOW CONTAINS:" |
echo "GL_PARAM TABLE NOW CONTAINS:" |
90 |
echo "" |
echo "" |