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.24 by valya, Tue Feb 5 19:16:40 2008 UTC vs.
Revision 1.40 by valya, Fri May 2 15:40:53 2008 UTC

# Line 1 | Line 1
1   ### RPM cms dbs-server DBS_1_0_8
2  
3 < %define cvstag %v
3 > %define cvstag %realversion
4   Source: cvs://:pserver:anonymous@cmscvs.cern.ch:2401/cvs_server/repositories/CMSSW?passwd=AA_:yZZ3e&module=DBS/Servers/JavaServer&export=DBS&tag=-r%{cvstag}&output=/dbs-server.tar.gz
5   Requires: apache-ant mysql mysql-deployment oracle apache-tomcat java-jdk dbs-schema
6  
# Line 12 | Line 12 | ps -w -w -f -u`whoami` | egrep "mysqld|t
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 52 | Line 54 | cat > %{i}/Servers/JavaServer/bin/dbs_in
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 \$DBS_SERVER_ROOT/etc/profile.d/init.sh
57 > source \$MYAREA/\$SCRAM_ARCH/external/apt/\$APT_VERSION/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
# Line 63 | Line 65 | MYSQL_ERR=\$MYSQL_PATH/error.log
65  
66   function dbs_stop()
67   {
68 <    echo $"Stop mysqld|tomcat running under `whoami` account..."
69 <    ps -w -w -f -u`whoami` | egrep "mysqld|tomcat" | grep -v egrep | awk '{print "kill -9 "\$2""}'|/bin/sh
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 &
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
# Line 90 | Line 93 | function dbs_status()
93         echo "MySQL server is not running"
94         exit 1
95      fi
96 <    ps -w -w -f -u`whoami` | egrep "mysqld" | grep -v egrep | awk '{print "MySQLd server running, pid="\$2""}'
97 <    ps -w -w -f -u`whoami` | egrep "tomcat" | grep -v egrep | awk '{print "Tomcat server running, pid="\$2""}'
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   }
# Line 166 | 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"
173 < echo "$DBS_SCHEMA_ROOT/Schema/NeXtGen/DBS-NeXtGen-MySQL_DEPLOYABLE.sql"
172 > #echo "$MYSQL_ROOT/bin/mysql -udbs -pcmsdbs --socket=$MYSQL_SOCK"
173 > echo "$DBS_SCHEMA_ROOT/lib/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.
176 < $MYSQL_ROOT/bin/mysql -uroot -pcms --socket=$MYSQL_SOCK < $DBS_SCHEMA_ROOT/Schema/NeXtGen/DBS-NeXtGen-MySQL_DEPLOYABLE.sql
176 > $MYSQL_ROOT/bin/mysql -uroot -pcms --socket=$MYSQL_SOCK < $DBS_SCHEMA_ROOT/lib/DBS-NeXtGen-MySQL_DEPLOYABLE.sql
177   $MYSQL_ROOT/bin/mysql --socket=$MYSQL_SOCK -uroot -pcms mysql -e "GRANT ALL ON ${DBS_SCHEMA_VERSION}.* TO dbs@localhost;"
178  
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 < echo
183 < echo
184 < echo "#####  IMPORTANT!!!  #####"
185 < echo "For your convinience we created"
186 < echo "$DBS_SERVER_ROOT/Servers/JavaServer/bin/dbs_init.sh"
187 < echo "init script file which can be placed into /etc/init.d/ to allow auto-startup of DBS service"
185 < echo "##### END OF README  #####"
186 < echo
182 > # Copy mysql jdbc driver to tomcat
183 > if [ ! -f $APACHE_TOMCAT_ROOT/common/lib/mysql-connector-java-5.0.5-bin.jar ]; then
184 > cp $DBS_SERVER_ROOT/Servers/JavaServer/lib/mysql-connector-java-5.0.5-bin.jar \
185 >   $APACHE_TOMCAT_ROOT/common/lib
186 > fi
187 >
188   # Fix path in dbs_init.sh file since now we know install area
189   cat $DBS_SERVER_ROOT/Servers/JavaServer/bin/dbs_init.sh | sed "s,rpm_install_area,$RPM_INSTALL_PREFIX,g" > \
190      $DBS_SERVER_ROOT/Servers/JavaServer/bin/dbs_init.sh.new
191 < mv  $DBS_SERVER_ROOT/Servers/JavaServer/bin/dbs_init.sh.new $DBS_SERVER_ROOT/Servers/JavaServer/bin/dbs_init.sh
191 > /bin/mv -f $DBS_SERVER_ROOT/Servers/JavaServer/bin/dbs_init.sh.new $DBS_SERVER_ROOT/Servers/JavaServer/bin/dbs_init.sh
192 > echo "+++ Fix path in dbs_init.sh"
193   chmod a+x $DBS_SERVER_ROOT/Servers/JavaServer/bin/dbs_init.sh
194  
195   # time to start up tomcat for user
196   #$APACHE_TOMCAT_ROOT/bin/catalina.sh start
197  
198   # kill running mysql|tomcat under my account since build is over
199 < ps -w -w -f -u`whoami` | egrep "mysqld|tomcat" | grep -v egrep | awk '{print "kill -9 "$2""}' |/bin/sh
199 > echo "+++ Clean-up mysqld|tomcat processes"
200 > #ps -w -w -f -u`whoami` | egrep "mysqld|tomcat" | grep -v egrep | awk '{print "kill -9 "$2""}'
201 > #ps -w -w -f -u`whoami` | egrep "mysqld|tomcat" | grep -v egrep | awk '{print "kill -9 "$2""}' |/bin/sh
202 > killall -q mysqld
203 > killall -q tomcat
204 >
205 > echo
206 > echo
207 > echo "#####  IMPORTANT!!!  #####"
208 > echo "To work with DBS you need to source init.sh file located at"
209 > echo "$DBS_SERVER_ROOT/etc/profile.d/init.sh"
210 > echo
211 > echo "OR use init script to start|stop|status DBS services:"
212 > echo "$DBS_SERVER_ROOT/Servers/JavaServer/bin/dbs_init.sh"
213 > echo "init script file can be placed into /etc/init.d/ to allow auto-startup of DBS service"
214 > echo "##########################"
215 > echo
216 >

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines