epics/Archiver Appliance インストールメモ: sampleStartup.sh

File sampleStartup.sh, 5.1 KB (added by shuei, 2 months ago)
Line 
1#!/bin/bash
2
3# Sample startup script for the archiver appliance
4# Please change the various environment variables to suit your environment.
5
6# We assume that we inherit the EPICS environment variables from something that calls this script
7# However, if this is a init.d startup script, this is not going to be the case and we'll need to add them here.
8# This includes setting up the LD_LIBRARY_PATH to include the JCA .so file.
9source /jk/dev/operation_app/jkControl/ArchiverAppliance/deploy/setEPICSEnv.sh
10
11#export JAVA_HOME=/jkbin/jdk
12export JAVA_HOME=/svjk/jkmisc/LinuxEL7/jdk-17.0.12+7
13export PATH=${JAVA_HOME}/bin:${PATH}
14# We use a lot of memory; so be generous with the heap.
15#export JAVA_OPTS="-XX:MaxPermSize=128M -XX:+UseG1GC -Xmx4G -Xms4G -ea"
16# memory configuration for J-PARC MR.
17export JAVA_OPTS="-XX:+UseG1GC -Xmx20G -Xms512M -ea"
18
19# Set up Tomcat home
20export TOMCAT_HOME=/opt/archappl-13-November-2019_tomcat-9.0.37/apache-tomcat-9.0.37
21
22# Set up the root folder of the individual Tomcat instances.
23export ARCHAPPL_DEPLOY_DIR=/opt/archappl-13-November-2019_tomcat-9.0.37
24
25# Set appliance.xml and the identity of this appliance
26export ARCHAPPL_APPLIANCES=/jk/dev/operation_app/jkControl/ArchiverAppliance/deploy/appliances.xml
27export ARCHAPPL_MYIDENTITY="appliance0"
28
29# If you have your own policies file, please change this line.
30export ARCHAPPL_POLICIES=/jk/dev/operation_app/jkControl/ArchiverAppliance/deploy/policies.py
31
32# Define our own properties file.
33export ARCHAPPL_PROPERTIES_FILENAME=/jk/dev/operation_app/jkControl/ArchiverAppliance/deploy/archappl.properties
34
35# Set the location of short term and long term stores; this is necessary only if your policy demands it
36export ARCHAPPL_SHORT_TERM_FOLDER=/localdata/archappl/sts/ArchiverStore
37export ARCHAPPL_MEDIUM_TERM_FOLDER=/localdata/archappl/mts/ArchiverStore
38export ARCHAPPL_LONG_TERM_FOLDER=/localdata/archappl/lts/ArchiverStore
39
40if [[ ! -d ${TOMCAT_HOME} ]]
41then
42    echo "Unable to determine the source of the tomcat distribution"
43    exit 1
44fi
45
46if [[ ! -f ${ARCHAPPL_APPLIANCES} ]]
47then
48    echo "Unable to find appliances.xml at ${ARCHAPPL_APPLIANCES}"
49    exit 1
50fi
51
52# Enable core dumps in case the JVM fails
53ulimit -c unlimited
54
55#
56export LANG=C
57
58# proxies for J-PARC
59export http_proxy=http://10.8.1.18:80/
60export HTTP_PROXY=$http_proxy
61export HTTPS_PROXY=$http_proxy
62export https_proxy=$http_proxy
63export ftp_proxy=$http_proxy
64
65export no_proxy=localhost,127.0.0.0/8,10.0.0.0/8,.jkcont
66export NO_PROXY=$no_proxy
67
68
69function startTomcatAtLocation() {
70    if [ -z "$1" ]; then echo "startTomcatAtLocation called without any arguments"; exit 1; fi
71    export CATALINA_HOME=$TOMCAT_HOME
72    export CATALINA_BASE=$1
73    echo "Starting tomcat at location ${CATALINA_BASE}"
74
75    ARCH=`uname -m`
76    if [[ $ARCH == 'x86_64' || $ARCH == 'amd64' ]]
77    then
78        echo "Using 64 bit versions of libraries"
79        export LD_LIBRARY_PATH=${CATALINA_BASE}/webapps/engine/WEB-INF/lib/native/linux-x86_64:${LD_LIBRARY_PATH}
80    else
81        echo "Using 32 bit versions of libraries"
82        export LD_LIBRARY_PATH=${CATALINA_BASE}/webapps/engine/WEB-INF/lib/native/linux-x86:${LD_LIBRARY_PATH}
83    fi
84
85    pushd ${CATALINA_BASE}/logs
86    ${CATALINA_HOME}/bin/jsvc \
87        -server \
88        -cp ${CATALINA_HOME}/bin/bootstrap.jar:${CATALINA_HOME}/bin/tomcat-juli.jar \
89        ${JAVA_OPTS} \
90        -Dcatalina.base=${CATALINA_BASE} \
91        -Dcatalina.home=${CATALINA_HOME} \
92        -cwd ${CATALINA_BASE}/logs \
93        -outfile ${CATALINA_BASE}/logs/catalina.out \
94        -errfile ${CATALINA_BASE}/logs/catalina.err \
95        -pidfile ${CATALINA_BASE}/pid \
96        org.apache.catalina.startup.Bootstrap start
97    popd
98}
99
100function stopTomcatAtLocation() {
101    if [ -z "$1" ]; then echo "stopTomcatAtLocation called without any arguments"; exit 1; fi
102    export CATALINA_HOME=$TOMCAT_HOME
103    export CATALINA_BASE=$1
104    echo "Stopping tomcat at location ${CATALINA_BASE}"
105    pushd ${CATALINA_BASE}/logs
106    ${CATALINA_HOME}/bin/jsvc \
107        -server \
108        -cp ${CATALINA_HOME}/bin/bootstrap.jar:${CATALINA_HOME}/bin/tomcat-juli.jar \
109        ${JAVA_OPTS} \
110        -Dcatalina.base=${CATALINA_BASE} \
111        -Dcatalina.home=${CATALINA_HOME} \
112        -cwd ${CATALINA_BASE}/logs \
113        -outfile ${CATALINA_BASE}/logs/catalina.out \
114        -errfile ${CATALINA_BASE}/logs/catalina.err \
115        -pidfile ${CATALINA_BASE}/pid \
116        -stop \
117        org.apache.catalina.startup.Bootstrap
118    popd
119}
120
121function stop() {
122    stopTomcatAtLocation ${ARCHAPPL_DEPLOY_DIR}/engine
123    stopTomcatAtLocation ${ARCHAPPL_DEPLOY_DIR}/retrieval
124    stopTomcatAtLocation ${ARCHAPPL_DEPLOY_DIR}/etl
125    stopTomcatAtLocation ${ARCHAPPL_DEPLOY_DIR}/mgmt
126}
127
128function start() {
129    startTomcatAtLocation ${ARCHAPPL_DEPLOY_DIR}/mgmt
130    startTomcatAtLocation ${ARCHAPPL_DEPLOY_DIR}/engine
131    startTomcatAtLocation ${ARCHAPPL_DEPLOY_DIR}/etl
132    startTomcatAtLocation ${ARCHAPPL_DEPLOY_DIR}/retrieval
133}
134
135
136# See how we were called.
137case "$1" in
138    start)
139        start
140        ;;
141    stop)
142        stop
143        ;;
144    restart)
145        stop
146        start
147        ;;
148    *)
149        echo $"Usage: $0 {start|stop|restart}"
150        exit 2
151esac
152
153# Local Variables:
154# sh-basic-offset:4
155# End: