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.29 by valya, Wed Feb 6 20:38:27 2008 UTC

# Line 1 | Line 1
1 < ### RPM cms dbs-server DBS_1_0_8
1 > ### RPM cms dbs-server DBS_1_0_9
2  
3   %define cvstag %v
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
# 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"
# Line 44 | Line 46 | cp -r Servers/JavaServer/* %{i}/Servers/
46   # copy war file
47   cp %{i}/Servers/JavaServer/DBS.war $APACHE_TOMCAT_ROOT/webapps
48  
49 + # create dbs init script
50 + mkdir -p %{i}/Servers/JavaServer/bin
51 + cat > %{i}/Servers/JavaServer/bin/dbs_init.sh << DBS_INIT_EOF
52 + #!/bin/sh
53 + export MYAREA=rpm_install_area
54 + export SCRAM_ARCH=slc4_ia32_gcc345
55 + source \$MYAREA/\$SCRAM_ARCH/external/apt/0.5.15lorg3.2-CMS3/etc/profile.d/init.sh
56 + source \$MYAREA/%{pkgrel}/etc/profile.d/init.sh
57 + # set DBS DBs
58 + MYSQL_PORT=3316
59 + MYSQL_PATH=\$MYSQL_ROOT/mysqldb
60 + MYSQL_SOCK=\$MYSQL_PATH/mysql.sock
61 + MYSQL_PID=\$MYSQL_PATH/mysqld.pid
62 + MYSQL_ERR=\$MYSQL_PATH/error.log
63 +
64 + function dbs_stop()
65 + {
66 +    me=\`whoami\`
67 +    echo $"Stop mysqld|tomcat running under \$me account..."
68 +    ps -w -w -f -u\$me | egrep "mysqld|tomcat" | grep -v egrep | awk '{print "kill -9 "\$2""}'|/bin/sh
69 + }
70 + function dbs_start()
71 + {
72 +    echo "+++ Start up CMS MySQL daemon on port \${MYSQL_PORT} ..."
73 +    \$MYSQL_ROOT/bin/mysqld_safe --datadir=\$MYSQL_PATH --port=\$MYSQL_PORT \
74 +    --socket=\$MYSQL_SOCK --log-error=\$MYSQL_ERR --pid-file=\$MYSQL_PID &
75 +    echo "+++ Start tomcat server"
76 +    \$APACHE_TOMCAT_ROOT/bin/catalina.sh start
77 +    sleep 2
78 +    echo
79 +    echo "DBS service is ready ..."
80 + }
81 + function dbs_status()
82 + {
83 +    me=\`whoami\`
84 +    dbs_mysqld=\`ps -w -w -f -u\$me | egrep "mysqld" | grep -v egrep | wc -l\`
85 +    dbs_tomcat=\`ps -w -w -f -u\$me | egrep "tomcat" | grep -v egrep | wc -l\`
86 +    if [ \${dbs_tomcat} -ne 1 ]; then
87 +       echo "Tomcat server is not running"
88 +       exit 1
89 +    fi
90 +    if [ \${dbs_mysqld} -ne 2 ]; then
91 +       echo "MySQL server is not running"
92 +       exit 1
93 +    fi
94 +    ps -w -w -f -u\$me | egrep "mysqld" | grep -v egrep | awk '{print "MySQLd server running, pid="\$2""}'
95 +    ps -w -w -f -u\$me | egrep "tomcat" | grep -v egrep | awk '{print "Tomcat server running, pid="\$2""}'
96 +    echo "For more information please have a look at tomcat log:"
97 +    echo "\$APACHE_TOMCAT_ROOT/logs/catalina.out"
98 + }
99 +
100 + RETVAL=\$?
101 +
102 + case "\$1" in
103 + restart)
104 +        dbs_stop
105 +        dbs_start
106 +        ;;
107 + start)
108 +        dbs_start
109 +        ;;
110 + status)
111 +        dbs_status
112 +        ;;
113 + stop)
114 +        dbs_stop
115 +        ;;
116 + *)
117 +        echo \$"Usage: \$0 {start|stop|status|restart}"
118 +        exit 1
119 +        ;;
120 + esac
121 +
122 + exit \$RETVAL
123 + DBS_INIT_EOF
124 + chmod a+x %{i}/Servers/JavaServer/bin/dbs_init.sh
125 +
126   mkdir -p %{i}/etc/profile.d
127   (echo "#!/bin/sh"; \
128   echo "source $ORACLE_ROOT/etc/profile.d/init.sh"; \
# Line 53 | Line 132 | mkdir -p %{i}/etc/profile.d
132   echo "source $APACHE_ANT_ROOT/etc/profile.d/init.sh"; \
133   echo "source $DBS_SCHEMA_ROOT/etc/profile.d/init.sh"; \
134   echo "source $JAVA_JDK_ROOT/etc/profile.d/init.sh"; \
135 + echo "export JAVA_HOME=$JAVA_JDK_ROOT"
136 + echo "export CATALINA_HOME=$APACHE_TOMCAT_ROOT"
137   ) > %{i}/etc/profile.d/dependencies-setup.sh
138  
139   (echo "#!/bin/tcsh"; \
# Line 63 | Line 144 | mkdir -p %{i}/etc/profile.d
144   echo "source $APACHE_ANT_ROOT/etc/profile.d/init.csh"; \
145   echo "source $DBS_SCHEMA_ROOT/etc/profile.d/init.csh"; \
146   echo "source $JAVA_JDK_ROOT/etc/profile.d/init.csh"; \
147 + echo "setenv JAVA_HOME $JAVA_JDK_ROOT"
148 + echo "setenv CATALINA_HOME $APACHE_TOMCAT_ROOT"
149   ) > %{i}/etc/profile.d/dependencies-setup.csh
150  
151  
# Line 84 | Line 167 | MYSQL_PID=$MYSQL_PATH/mysqld.pid
167   MYSQL_ERR=$MYSQL_PATH/error.log
168   # grant permissions to CMS MySQL DBS account
169   echo "+++ Grand permission to dbs account, DBS DB ${DBS_SCHEMA_VERSION} ..."
170 < echo "$MYSQL_ROOT/bin/mysql -udbs -pcmsdbs --socket=$MYSQL_SOCK"
170 > #echo "$MYSQL_ROOT/bin/mysql -udbs -pcmsdbs --socket=$MYSQL_SOCK"
171   echo "$DBS_SCHEMA_ROOT/Schema/NeXtGen/DBS-NeXtGen-MySQL_DEPLOYABLE.sql"
172   # DBS uses trigger which requires to have SUPER priveleges, so we'll create DB using root
173   # and delegate this to dbs account.
# Line 94 | Line 177 | $MYSQL_ROOT/bin/mysql --socket=$MYSQL_SO
177   # I need to copy/deploy DBS.war file into tomcat area
178   cp $DBS_SERVER_ROOT/Servers/JavaServer/DBS.war $APACHE_TOMCAT_ROOT/webapps
179  
180 + echo
181 + echo
182 + echo "#####  IMPORTANT!!!  #####"
183 + echo "For your convinience we created"
184 + echo "$DBS_SERVER_ROOT/Servers/JavaServer/bin/dbs_init.sh"
185 + echo "init script file which can be placed into /etc/init.d/ to allow auto-startup of DBS service"
186 + echo "##### END OF README  #####"
187 + echo
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
192 + chmod a+x $DBS_SERVER_ROOT/Servers/JavaServer/bin/dbs_init.sh
193 +
194 + # time to start up tomcat for user
195 + #$APACHE_TOMCAT_ROOT/bin/catalina.sh start
196 +
197 + # kill running mysql|tomcat under my account since build is over
198 + ps -w -w -f -u`whoami` | egrep "mysqld|tomcat" | grep -v egrep | awk '{print "kill -9 "$2""}' |/bin/sh

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines