/[PAMELA software]/DarthVader/docs/install_GL_PARAM.sh
ViewVC logotype

Annotation of /DarthVader/docs/install_GL_PARAM.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download) (as text)
Wed Sep 6 15:20:21 2006 UTC (18 years, 3 months ago) by mocchiut
Branch: MAIN
File MIME type: application/x-sh
New version, adapted to YodaProfiler v1r02

1 mocchiut 1.1 #!/bin/bash --norc
2     THISDIR=`pwd`
3     USERNAME=""
4     HOST=""
5     DBNAME=""
6     PASSWORD=""
7     if [ $# -gt 0 ] && [ $# -le 4 ]; then
8     I=1
9     while [ $I -le $# ]; do
10     if [ $I -eq 1 ]; then
11     INPUT=$1
12     fi
13     if [ $I -eq 2 ]; then
14     INPUT=$2
15     fi
16     if [ $I -eq 3 ]; then
17     INPUT=$3
18     fi
19     if [ $I -eq 4 ]; then
20     INPUT=$4
21     fi
22     if [ $INPUT == "--help" ] || [ $INPUT == "-h" ]; then
23     echo ""
24     echo " Usage: ./install_GL_PARAM.sh [options] "
25     echo ""
26     echo " Options: "
27     echo ""
28     echo " --user=username : MySQL username. "
29     echo ""
30     echo " --host=mysql://localhost/pamelaprod : MySQL host and DB name."
31     echo ""
32     echo " --psw=password : MySQL password"
33     echo ""
34     exit 0
35     fi
36     TEST=`echo $INPUT | sed 's/--user=//g'`
37     if [ $TEST != $INPUT ]; then
38     USERNAME=`echo $TEST`
39     export USERNAME;
40     fi
41     TEST=`echo $INPUT | sed 's/--host=//g'`
42     if [ $TEST != $INPUT ]; then
43     COUNT=0;for word in `echo $TEST | 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
44     export DBNAME;
45     export HOST;
46     fi
47     TEST=`echo $INPUT | sed 's/--psw=//g'`
48     if [ $TEST != $INPUT ]; then
49     PASSWORD=`echo $TEST`
50     export PASSWORD;
51     fi
52     let I=$I+1
53     done
54     else
55     echo ""
56     echo " Usage: ./install_GL_PARAM.sh [options] "
57     echo ""
58     echo " Options: "
59     echo ""
60     echo " --user=username : MySQL username. "
61     echo ""
62     echo " --host=mysql://localhost/pamelaprod : MySQL host and DB name."
63     echo ""
64     echo " --psw=password : MySQL password"
65     echo ""
66     exit 0
67     fi;
68     #
69     rm -rf ${THISDIR}/temp.sql
70     PAM_CALIB2=$(echo $PAM_CALIB | sed 's/\//\\\//g')
71     #
72     echo "delete from GL_PARAM;" > ${THISDIR}/temp.sql
73     mysql --user=$USERNAME --password=$PASSWORD --host=$HOST $DBNAME < ${THISDIR}/temp.sql
74     #
75     cat ${THISDIR}/install_GL_PARAM.sql | sed 's/fullpathgoesere/'${PAM_CALIB2}'/g' >> ${THISDIR}/temp.sql
76     mysql --user=$USERNAME --password=$PASSWORD --host=$HOST $DBNAME < ${THISDIR}/temp.sql
77     #
78     echo ""
79     echo "GL_PARAM TABLE NOW CONTAINS:"
80     echo ""
81     echo "select * from GL_PARAM;" > ${THISDIR}/temp.sql
82     mysql --user=$USERNAME --password=$PASSWORD --host=$HOST $DBNAME < ${THISDIR}/temp.sql
83     echo ""
84     echo "Please check that path and names are correct."
85     echo ""
86     #
87     rm -rf ${THISDIR}/temp.sql

  ViewVC Help
Powered by ViewVC 1.1.23