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

Last change on this file since 4084 was 4084, checked in by olle, 12 years ago

Refs #668. Initialization script www/WEB-INF/init.sh in client/servlet/ updated to create msinspect.properties file if not existing.

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 4.5 KB
Line 
1#!/bin/sh
2
3# $Id: init.sh 4084 2010-12-20 12:40:56Z 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 log4j.properties file if not existing.
107if [ ! -f log4j.properties ]; then
108  cp -p log4j.properties.in log4j.properties
109fi
110
111# Update proteios Proteios FTP Server start script
112java -jar ../lib/Replace.jar \
113                $SERVICE_PATH/proteios_ftp_server.sh.in $SERVICE_PATH/proteios_ftp_server.sh \
114                __CATALINA_HOME__="$CATALINA_HOME" \
115                __FTP_CONTROL_PORT__=$FTP_CONTROL_PORT \
116                __TEMP_FILES_DIR__=$TEMP_FILES_DIR
117
118# End configuration replacements
119cd ..
120
121# Build classpath
122CP=classes
123for i in `ls lib/*.jar`; do CP=${CP}:${i}; done
124
125# Create user files directory if not existing.
126mkdir -p "$USER_FILES_DIR/conf"
127chown $TOMCAT_USER -R $USER_FILES_DIR
128chgrp $TOMCAT_GROUP -R $USER_FILES_DIR
129
130# Create temporary files directory if not existing.
131mkdir -p "$TEMP_FILES_DIR"
132chown $TOMCAT_USER -R $TEMP_FILES_DIR
133chgrp $TOMCAT_GROUP -R $TEMP_FILES_DIR
134
135# Initialize database
136java -server -cp $CP org.proteios.install.InitDB $APP_ROOT_PWD
137
138
139if [ -e $SERVICE_PATH/proteios_ftp_server.sh ]; then
140  chmod ugo+x $SERVICE_PATH/proteios_ftp_server.sh
141else
142  echo "warning: $SERVICE_PATH/proteios_ftp_server.sh is missing"
143fi
144
145
Note: See TracBrowser for help on using the repository browser.