ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/dbs-server.spec
(Generate patch)

Comparing COMP/CMSDIST/dbs-server.spec (file contents):
Revision 1.22 by valya, Tue Jan 29 18:21:07 2008 UTC vs.
Revision 1.37 by valya, Tue Apr 29 13:00:23 2008 UTC

# Line 6 | Line 6 | Requires: apache-ant mysql mysql-deploym
6  
7   %prep
8   %setup -n DBS
9 + # kill running mysql|tomcat under my account since build is over
10 + ps -w -w -f -u`whoami` | egrep "mysqld|tomcat" | grep -v egrep | awk '{print "kill -9 "$2""}' |/bin/sh
11  
12   %build
13   echo "PWD=$PWD"
14   cd Servers/JavaServer
15 + ver="DBS_1_0_8"
16   # fix context.xml file
17   cat > etc/context.xml << EOF_CONTEXT
18   <Context path="/servlet/DBSServlet" docBase="DBSServlet" debug="5" reloadable="true" crossContext="true">
19 <     <SupportedSchemaVersion schemaversion="DBS_1_0_8" />
20 <     <SupportedClientVersions clientversions="DBS_1_0_1, DBS_1_0_5, DBS_1_0_7, DBS_1_0_8, DBS_1_0_9"/>
19 >     <SchemaOwner schemaowner="${ver}" />
20 >     <SupportedSchemaVersion schemaversion="${ver}" />
21 >     <SupportedClientVersions clientversions="DBS_1_0_1, DBS_1_0_5, DBS_1_0_7, DBS_1_0_8"/>
22       <DBSBlockConfig maxBlockSize="2000000000000" maxBlockFiles="100" />
23                          
24       <Resource name="jdbc/dbs"
# Line 44 | Line 48 | cp -r Servers/JavaServer/* %{i}/Servers/
48   # copy war file
49   cp %{i}/Servers/JavaServer/DBS.war $APACHE_TOMCAT_ROOT/webapps
50  
51 + # create dbs init script
52 + mkdir -p %{i}/Servers/JavaServer/bin
53 + cat > %{i}/Servers/JavaServer/bin/dbs_init.sh << DBS_INIT_EOF
54 + #!/bin/sh
55 + export MYAREA=rpm_install_area
56 + export SCRAM_ARCH=slc4_ia32_gcc345
57 + source \$MYAREA/\$SCRAM_ARCH/external/apt/0.5.15lorg3.2-CMS3/etc/profile.d/init.sh
58 + source \$MYAREA/%{pkgrel}/etc/profile.d/init.sh
59 + # set DBS DBs
60 + MYSQL_PORT=3316
61 + MYSQL_PATH=\$MYSQL_ROOT/mysqldb
62 + MYSQL_SOCK=\$MYSQL_PATH/mysql.sock
63 + MYSQL_PID=\$MYSQL_PATH/mysqld.pid
64 + MYSQL_ERR=\$MYSQL_PATH/error.log
65 +
66 + function dbs_stop()
67 + {
68 +    me=\`whoami\`
69 +    echo $"Stop mysqld|tomcat running under \$me account..."
70 +    ps -w -w -f -u\$me | egrep "mysqld|tomcat" | grep -v egrep | awk '{print "kill -9 "\$2""}'|/bin/sh
71 + }
72 + function dbs_start()
73 + {
74 +    echo "+++ Start up CMS MySQL daemon on port \${MYSQL_PORT} ..."
75 +    \$MYSQL_ROOT/bin/mysqld_safe --datadir=\$MYSQL_PATH --port=\$MYSQL_PORT \
76 +    --socket=\$MYSQL_SOCK --log-error=\$MYSQL_ERR --pid-file=\$MYSQL_PID --max_allowed_packet=32M &
77 +    echo "+++ Start tomcat server"
78 +    \$APACHE_TOMCAT_ROOT/bin/catalina.sh start
79 +    sleep 2
80 +    echo
81 +    echo "DBS service is ready ..."
82 + }
83 + function dbs_status()
84 + {
85 +    me=\`whoami\`
86 +    dbs_mysqld=\`ps -w -w -f -u\$me | egrep "mysqld" | grep -v egrep | wc -l\`
87 +    dbs_tomcat=\`ps -w -w -f -u\$me | egrep "tomcat" | grep -v egrep | wc -l\`
88 +    if [ \${dbs_tomcat} -ne 1 ]; then
89 +       echo "Tomcat server is not running"
90 +       exit 1
91 +    fi
92 +    if [ \${dbs_mysqld} -ne 2 ]; then
93 +       echo "MySQL server is not running"
94 +       exit 1
95 +    fi
96 +    ps -w -w -f -u\$me | egrep "mysqld" | grep -v egrep | awk '{print "MySQLd server running, pid="\$2""}'
97 +    ps -w -w -f -u\$me | egrep "tomcat" | grep -v egrep | awk '{print "Tomcat server running, pid="\$2""}'
98 +    echo "For more information please have a look at tomcat log:"
99 +    echo "\$APACHE_TOMCAT_ROOT/logs/catalina.out"
100 + }
101 +
102 + RETVAL=\$?
103 +
104 + case "\$1" in
105 + restart)
106 +        dbs_stop
107 +        dbs_start
108 +        ;;
109 + start)
110 +        dbs_start
111 +        ;;
112 + status)
113 +        dbs_status
114 +        ;;
115 + stop)
116 +        dbs_stop
117 +        ;;
118 + *)
119 +        echo \$"Usage: \$0 {start|stop|status|restart}"
120 +        exit 1
121 +        ;;
122 + esac
123 +
124 + exit \$RETVAL
125 + DBS_INIT_EOF
126 + chmod a+x %{i}/Servers/JavaServer/bin/dbs_init.sh
127 +
128   mkdir -p %{i}/etc/profile.d
129   (echo "#!/bin/sh"; \
130   echo "source $ORACLE_ROOT/etc/profile.d/init.sh"; \
# Line 53 | Line 134 | mkdir -p %{i}/etc/profile.d
134   echo "source $APACHE_ANT_ROOT/etc/profile.d/init.sh"; \
135   echo "source $DBS_SCHEMA_ROOT/etc/profile.d/init.sh"; \
136   echo "source $JAVA_JDK_ROOT/etc/profile.d/init.sh"; \
137 + echo "export JAVA_HOME=$JAVA_JDK_ROOT"
138 + echo "export CATALINA_HOME=$APACHE_TOMCAT_ROOT"
139   ) > %{i}/etc/profile.d/dependencies-setup.sh
140  
141   (echo "#!/bin/tcsh"; \
# Line 63 | Line 146 | mkdir -p %{i}/etc/profile.d
146   echo "source $APACHE_ANT_ROOT/etc/profile.d/init.csh"; \
147   echo "source $DBS_SCHEMA_ROOT/etc/profile.d/init.csh"; \
148   echo "source $JAVA_JDK_ROOT/etc/profile.d/init.csh"; \
149 + echo "setenv JAVA_HOME $JAVA_JDK_ROOT"
150 + echo "setenv CATALINA_HOME $APACHE_TOMCAT_ROOT"
151   ) > %{i}/etc/profile.d/dependencies-setup.csh
152  
153  
# Line 84 | Line 169 | MYSQL_PID=$MYSQL_PATH/mysqld.pid
169   MYSQL_ERR=$MYSQL_PATH/error.log
170   # grant permissions to CMS MySQL DBS account
171   echo "+++ Grand permission to dbs account, DBS DB ${DBS_SCHEMA_VERSION} ..."
172 < echo "$MYSQL_ROOT/bin/mysql -udbs -pcmsdbs --socket=$MYSQL_SOCK"
172 > #echo "$MYSQL_ROOT/bin/mysql -udbs -pcmsdbs --socket=$MYSQL_SOCK"
173   echo "$DBS_SCHEMA_ROOT/Schema/NeXtGen/DBS-NeXtGen-MySQL_DEPLOYABLE.sql"
174   # DBS uses trigger which requires to have SUPER priveleges, so we'll create DB using root
175   # and delegate this to dbs account.
# Line 94 | Line 179 | $MYSQL_ROOT/bin/mysql --socket=$MYSQL_SO
179   # I need to copy/deploy DBS.war file into tomcat area
180   cp $DBS_SERVER_ROOT/Servers/JavaServer/DBS.war $APACHE_TOMCAT_ROOT/webapps
181  
182 + # Fix path in dbs_init.sh file since now we know install area
183 + cat $DBS_SERVER_ROOT/Servers/JavaServer/bin/dbs_init.sh | sed "s,rpm_install_area,$RPM_INSTALL_PREFIX,g" > \
184 +    $DBS_SERVER_ROOT/Servers/JavaServer/bin/dbs_init.sh.new
185 + /bin/mv -f $DBS_SERVER_ROOT/Servers/JavaServer/bin/dbs_init.sh.new $DBS_SERVER_ROOT/Servers/JavaServer/bin/dbs_init.sh
186 + echo "+++ Fix path in dbs_init.sh"
187 + chmod a+x $DBS_SERVER_ROOT/Servers/JavaServer/bin/dbs_init.sh
188 +
189 + # time to start up tomcat for user
190 + #$APACHE_TOMCAT_ROOT/bin/catalina.sh start
191 +
192 + # kill running mysql|tomcat under my account since build is over
193 + echo "+++ Clean-up mysqld|tomcat processes"
194 + #ps -w -w -f -u`whoami` | egrep "mysqld|tomcat" | grep -v egrep | awk '{print "kill -9 "$2""}'
195 + #ps -w -w -f -u`whoami` | egrep "mysqld|tomcat" | grep -v egrep | awk '{print "kill -9 "$2""}' |/bin/sh
196 + killall -q mysqld
197 + killall -q tomcat
198 +
199 + echo
200 + echo
201 + echo "#####  IMPORTANT!!!  #####"
202 + echo "To work with DBS you need to source init.sh file located at"
203 + echo "$DBS_SERVER_ROOT/etc/profile.d/init.sh"
204 + echo
205 + echo "OR use init script to start|stop|status DBS services:"
206 + echo "$DBS_SERVER_ROOT/Servers/JavaServer/bin/dbs_init.sh"
207 + echo "init script file can be placed into /etc/init.d/ to allow auto-startup of DBS service"
208 + echo "##########################"
209 + echo
210 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines