source: trunk/client/servlet/www/WEB-INF/init.sh @ 4371

Last change on this file since 4371 was 4371, checked in by olle, 11 years ago

Refs #788. Unix/Linux *.sh shell scripts have the shebang line changed from "#!/bin/sh" to "#!/bin/bash", in order to make the scripts work on Ubunto Linux without explicitly defining the shell.

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 4.6 KB
Line 
1#!/bin/bash
2
3# $Id: init.sh 4371 2012-10-26 09:52:50Z olle $
4
5#  Copyright (C) 2009 Gregory Vincic
6
7#  Files are copyright by their respective authors. The contributions to
8#  files where copyright is not explicitly stated can be traced with the
9#  source code revision system.
10
11#  This file is part of Proteios.
12#  Available at http://www.proteios.org/
13
14#  Proteios is free software; you can redistribute it and/or
15#  modify it under the terms of the GNU General Public License
16#  as published by the Free Software Foundation; either version 2
17#  of the License, or (at your option) any later version.
18
19#  Proteios is distributed in the hope that it will be useful,
20#  but WITHOUT ANY WARRANTY; without even the implied warranty of
21#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22#  GNU General Public License for more details.
23
24#  You should have received a copy of the GNU General Public License
25#  along with this program; if not, write to the Free Software
26#  Foundation, Inc., 59 Temple Place - Suite 330,
27#  Boston, MA  02111-1307, USA.
28
29# Configuration script that should be used after istallation. (rpm only)
30
31. ./config
32
33
34stty -echo
35read -p "Mysql password for user $DB_MANAGER: " DB_MANAGER_PWD; echo
36SQL_EXEC="mysql -h $DB_HOST -u $DB_MANAGER -p$DB_MANAGER_PWD -e"
37DB_EXISTS=`$SQL_EXEC "show databases" | grep "^$DB_NAME\$"`
38if [ "$DB_EXISTS" == "$DB_NAME" ]; then
39  echo "Database '$DB_NAME' already exists. Change DB_NAME in config file and try again."
40  stty echo
41  exit
42fi
43
44read -p "Proteios SE password for root: " APP_ROOT_PWD; echo
45stty echo
46HOST_NAME=`java -jar lib/GetHostName.jar`
47
48
49# Create database and user
50$SQL_EXEC "CREATE DATABASE IF NOT EXISTS \`$DB_NAME\` DEFAULT CHARACTER SET utf8;"
51$SQL_EXEC "GRANT ALL ON \`$DB_NAME\`.* TO '$APP_USER'@'$DB_HOST' IDENTIFIED BY '$APP_USER_PWD'; FLUSH PRIVILEGES;"
52
53# Update proteios web.xml file (used by Tomcat)
54java -jar lib/Replace.jar \
55                web.xml.in web.xml \
56                __TEMPFILES__="$TEMP_FILES_DIR"
57
58cd classes
59java -jar ../lib/Replace.jar \
60                proteios.config.in proteios.config \
61                __USERNAME__=$APP_USER \
62                __PASSWORD__=$APP_USER_PWD \
63                __DATABASE__=$DB_NAME \
64                __USERFILES__="$USER_FILES_DIR" \
65                __HOST__=$DB_HOST \
66                __SMTPHOST__=$MAIL_SERVER \
67                __MAIL_FROM_ADDRESS__=$MAIL_FROM_ADDRESS
68
69
70# Update proteios ftp.properties file (used by FTP Server)
71java -jar ../lib/Replace.jar \
72                ftp.properties.in ftp.properties \
73                __CONTROL_PORT__=$FTP_CONTROL_PORT \
74                __PASSIVE_PORT_RANGE__=$FTP_PASSIVE_PORT_RANGE \
75                __USERNAME__=$APP_USER \
76                __PASSWORD__=$APP_USER_PWD \
77                __DATABASE__=$DB_NAME \
78                __USERFILES__="$USER_FILES_DIR" \
79                __HOST__=$DB_HOST
80
81# Create proteios xtandem.properties file if not existing.
82if [ ! -f xtandem.properties ]; then
83  cp -p xtandem.properties.in xtandem.properties
84fi
85
86# Create proteios mascot.properties file if not existing.
87if [ ! -f mascot.properties ]; then
88  cp -p mascot.properties.in mascot.properties
89fi
90
91# Create proteios omssa.properties file if not existing.
92if [ ! -f omssa.properties ]; then
93  cp -p omssa.properties.in omssa.properties
94fi
95
96# Create proteios pike.properties file if not existing.
97if [ ! -f pike.properties ]; then
98  cp -p pike.properties.in pike.properties
99fi
100
101# Create proteios msinspect.properties file if not existing.
102if [ ! -f msinspect.properties ]; then
103  cp -p msinspect.properties.in msinspect.properties
104fi
105
106# Create proteios openms.properties file if not existing.
107if [ ! -f openms.properties ]; then
108  cp -p openms.properties.in openms.properties
109fi
110
111# Create proteios log4j.properties file if not existing.
112if [ ! -f log4j.properties ]; then
113  cp -p log4j.properties.in log4j.properties
114fi
115
116# Update proteios Proteios FTP Server start script
117java -jar ../lib/Replace.jar \
118                $SERVICE_PATH/proteios_ftp_server.sh.in $SERVICE_PATH/proteios_ftp_server.sh \
119                __CATALINA_HOME__="$CATALINA_HOME" \
120                __FTP_CONTROL_PORT__=$FTP_CONTROL_PORT \
121                __TEMP_FILES_DIR__=$TEMP_FILES_DIR
122
123# End configuration replacements
124cd ..
125
126# Build classpath
127CP=classes
128for i in `ls lib/*.jar`; do CP=${CP}:${i}; done
129
130# Create user files directory if not existing.
131mkdir -p "$USER_FILES_DIR/conf"
132chown $TOMCAT_USER -R $USER_FILES_DIR
133chgrp $TOMCAT_GROUP -R $USER_FILES_DIR
134
135# Create temporary files directory if not existing.
136mkdir -p "$TEMP_FILES_DIR"
137chown $TOMCAT_USER -R $TEMP_FILES_DIR
138chgrp $TOMCAT_GROUP -R $TEMP_FILES_DIR
139
140# Initialize database
141java -server -cp $CP org.proteios.install.InitDB $APP_ROOT_PWD
142
143
144if [ -e $SERVICE_PATH/proteios_ftp_server.sh ]; then
145  chmod ugo+x $SERVICE_PATH/proteios_ftp_server.sh
146else
147  echo "warning: $SERVICE_PATH/proteios_ftp_server.sh is missing"
148fi
149
150
Note: See TracBrowser for help on using the repository browser.