Mentions légales du service

Skip to content
Snippets Groups Projects
Commit b5479432 authored by Simon Ebel's avatar Simon Ebel
Browse files

fix: uncomment

parent 47e99c50
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
. ./utils
function printUsage() {
cat <<EOF
......@@ -54,138 +53,138 @@ while [ $# -gt 0 ]; do
esac
done
# CS_DIR=$(pwd)/connection-studio-dir
# function isTomcatRunning() {
# STAT=$(netstat -an | grep "\b8080")
# IFS=' '
# read -a PARSED_STAT <<<"$STAT"
# PARSED_LENGTH=${#PARSED_STAT[@]}
# if [ -z "$PARSED_STAT" ] || [ "${PARSED_STAT[$PARSED_LENGTH - 1]}" == "TIME_WAIT" ]; then
# IS_TOMCAT_RUNNING=false
# elif [ "${PARSED_STAT[$PARSED_LENGTH - 1]}" == "LISTEN" ]; then
# IS_TOMCAT_RUNNING=true
# fi
# }
# IS_TOMCAT_WAITING=true
# function isTomcatWaiting() {
# PORT=$1
# if [ "$PORT" == "8080" ]; then
# CRIT="FIN_WAIT2"
# elif [ "$PORT" == "8005" ]; then
# CRIT="TIME_WAIT"
# fi
# STAT=$(netstat -an | grep "\b$PORT")
# IFS=' '
# read -a PARSED_STAT <<<"$STAT"
# PARSED_LENGTH=${#PARSED_STAT[@]}
# if [[ -z "$PARSED_STAT" ]]; then
# IS_TOMCAT_WAITING=false
# elif [ -n "$PARSED_STAT" ] && [ "${PARSED_STAT[$PARSED_LENGTH - 1]}" == "$CRIT" ]; then
# IS_TOMCAT_WAITING=true
# else
# IS_TOMCAT_WAITING=false
# fi
# }
# if [ "$CONFIGURE" == "true" ]; then
# bash $BASE_DIR/install/configure.sh
# cp $CS_DIR/local.settings $BASE_DIR/webservices/WebContent/WEB-INF/
# fi
# # if [ ! -d $CS_DIR ]; then
# # echo "CS_DIR does not exist, set it up"
# # bash $BASE_DIR/install/configure.sh
# # fi
# if [ -z "$CATALINA_HOME" ]; then
# echo "CATALINA_HOME hasn't been setup, exiting..."
# exit 1
# fi
# if [ "$PURGE" == "true" ]; then
# echo "Flushing maven cache"
# rm -r ~/.m2
# fi
# if [ "$REACT" == "true" ]; then
# WAR=connectionstudio.war
# WORK_DIR=$BASE_DIR/front
# CURRENT="React"
# else
# WAR=webservices.war
# WORK_DIR=$BASE_DIR/webservices
# CURRENT="WebServices"
# fi
# WAR_NAME=$(echo $WAR | cut -d'.' -f 1)
# if [ -d "$CATALINA_HOME/webapps/$WAR_NAME/WEB-INF/uploads" ]; then
# echo "Saving upload file before deleting Tomcat cache"
# cp -r $CATALINA_HOME/webapps/$WAR_NAME/WEB-INF/uploads $CATALINA_HOME/webapps
# fi
# sleep 2
# isTomcatRunning
# if [ "$IS_TOMCAT_RUNNING" == "true" ]; then
# IS_TOMCAT_WAITING=true
# while [ "$IS_TOMCAT_WAITING" == "true" ]; do
# isTomcatWaiting "8005"
# done
# echo "Shutting down Tomcat"
# echo "---------------------------------------------------------"
# $CATALINA_HOME/bin/shutdown.sh
# echo "---------------------------------------------------------"
# IS_TOMCAT_WAITING=true
# while [ "$IS_TOMCAT_WAITING" == "true" ]; do
# isTomcatWaiting "8080"
# done
# fi
# cd $WORK_DIR
# echo "Deploying $CURRENT module"
# mvn -U clean install -DskipTests
# WAR_PATH=$WORK_DIR/target/$WAR
# if [ ! -f "$WAR_PATH" ]; then
# echo "$WAR_PATH does not exist, exiting..."
# exit 1
# fi
# if [ -d "$CATALINA_HOME/webapps/$WAR_NAME" ]; then
# echo "Removing Tomcat $CATALINA_HOME/webapps/$WAR_NAME folder"
# rm -r $CATALINA_HOME/webapps/$WAR_NAME
# # rm -r $CATALINA_HOME/work/
# fi
CS_DIR=$(pwd)/connection-studio-dir
function isTomcatRunning() {
STAT=$(netstat -an | grep "\b8080")
IFS=' '
read -a PARSED_STAT <<<"$STAT"
PARSED_LENGTH=${#PARSED_STAT[@]}
if [ -z "$PARSED_STAT" ] || [ "${PARSED_STAT[$PARSED_LENGTH - 1]}" == "TIME_WAIT" ]; then
IS_TOMCAT_RUNNING=false
elif [ "${PARSED_STAT[$PARSED_LENGTH - 1]}" == "LISTEN" ]; then
IS_TOMCAT_RUNNING=true
fi
}
IS_TOMCAT_WAITING=true
function isTomcatWaiting() {
PORT=$1
if [ "$PORT" == "8080" ]; then
CRIT="FIN_WAIT2"
elif [ "$PORT" == "8005" ]; then
CRIT="TIME_WAIT"
fi
STAT=$(netstat -an | grep "\b$PORT")
IFS=' '
read -a PARSED_STAT <<<"$STAT"
PARSED_LENGTH=${#PARSED_STAT[@]}
if [[ -z "$PARSED_STAT" ]]; then
IS_TOMCAT_WAITING=false
elif [ -n "$PARSED_STAT" ] && [ "${PARSED_STAT[$PARSED_LENGTH - 1]}" == "$CRIT" ]; then
IS_TOMCAT_WAITING=true
else
IS_TOMCAT_WAITING=false
fi
}
# if [ -f "$CATALINA_HOME/webapps/$WAR" ]; then
# echo "Removing Tomcat $CATALINA_HOME/webapps/$WAR war"
# rm $CATALINA_HOME/webapps/$WAR
# fi
if [ "$CONFIGURE" == "true" ]; then
bash $BASE_DIR/install/configure.sh
cp $CS_DIR/local.settings $BASE_DIR/webservices/WebContent/WEB-INF/
fi
# if [ -f $WAR_PATH ]; then
# echo "Deploying $CURRENT module into Tomcat"
# cp $WAR_PATH $CATALINA_HOME/webapps
# if [ ! -d $CS_DIR ]; then
# echo "CS_DIR does not exist, set it up"
# bash $BASE_DIR/install/configure.sh
# fi
# sleep 2
# IS_TOMCAT_WAITING=true
# while [ "$IS_TOMCAT_WAITING" == "true" ]; do
# isTomcatWaiting "8080"
# done
# isTomcatRunning
# if [ "$IS_TOMCAT_RUNNING" == "false" ]; then
# echo "Starting Tomcat"
# echo "---------------------------------------------------------"
# $CATALINA_HOME/bin/startup.sh
# echo "---------------------------------------------------------"
# fi
if [ -z "$CATALINA_HOME" ]; then
echo "CATALINA_HOME hasn't been setup, exiting..."
exit 1
fi
if [ "$PURGE" == "true" ]; then
echo "Flushing maven cache"
rm -r ~/.m2
fi
if [ "$REACT" == "true" ]; then
WAR=connectionstudio.war
WORK_DIR=$BASE_DIR/front
CURRENT="React"
else
WAR=webservices.war
WORK_DIR=$BASE_DIR/webservices
CURRENT="WebServices"
fi
WAR_NAME=$(echo $WAR | cut -d'.' -f 1)
if [ -d "$CATALINA_HOME/webapps/$WAR_NAME/WEB-INF/uploads" ]; then
echo "Saving upload file before deleting Tomcat cache"
cp -r $CATALINA_HOME/webapps/$WAR_NAME/WEB-INF/uploads $CATALINA_HOME/webapps
fi
sleep 2
isTomcatRunning
if [ "$IS_TOMCAT_RUNNING" == "true" ]; then
IS_TOMCAT_WAITING=true
while [ "$IS_TOMCAT_WAITING" == "true" ]; do
isTomcatWaiting "8005"
done
echo "Shutting down Tomcat"
echo "---------------------------------------------------------"
$CATALINA_HOME/bin/shutdown.sh
echo "---------------------------------------------------------"
IS_TOMCAT_WAITING=true
while [ "$IS_TOMCAT_WAITING" == "true" ]; do
isTomcatWaiting "8080"
done
fi
cd $WORK_DIR
echo "Deploying $CURRENT module"
mvn -U clean install -DskipTests
WAR_PATH=$WORK_DIR/target/$WAR
if [ ! -f "$WAR_PATH" ]; then
echo "$WAR_PATH does not exist, exiting..."
exit 1
fi
if [ -d "$CATALINA_HOME/webapps/$WAR_NAME" ]; then
echo "Removing Tomcat $CATALINA_HOME/webapps/$WAR_NAME folder"
rm -r $CATALINA_HOME/webapps/$WAR_NAME
# rm -r $CATALINA_HOME/work/
fi
if [ -f "$CATALINA_HOME/webapps/$WAR" ]; then
echo "Removing Tomcat $CATALINA_HOME/webapps/$WAR war"
rm $CATALINA_HOME/webapps/$WAR
fi
if [ -f $WAR_PATH ]; then
echo "Deploying $CURRENT module into Tomcat"
cp $WAR_PATH $CATALINA_HOME/webapps
fi
sleep 2
IS_TOMCAT_WAITING=true
while [ "$IS_TOMCAT_WAITING" == "true" ]; do
isTomcatWaiting "8080"
done
# echo "$CURRENT successfully deployed"
# if [ -d "$CATALINA_HOME/webapps/uploads/" ] && [ -d "$CATALINA_HOME/webapps/$WAR_NAME/WEB-INF/" ]; then
# echo "Adding saved upload files to Tomcat"
# sleep 2
# mv $CATALINA_HOME/webapps/uploads/ $CATALINA_HOME/webapps/$WAR_NAME/WEB-INF/
# fi
isTomcatRunning
if [ "$IS_TOMCAT_RUNNING" == "false" ]; then
echo "Starting Tomcat"
echo "---------------------------------------------------------"
$CATALINA_HOME/bin/startup.sh
echo "---------------------------------------------------------"
fi
echo "$CURRENT successfully deployed"
if [ -d "$CATALINA_HOME/webapps/uploads/" ] && [ -d "$CATALINA_HOME/webapps/$WAR_NAME/WEB-INF/" ]; then
echo "Adding saved upload files to Tomcat"
sleep 2
mv $CATALINA_HOME/webapps/uploads/ $CATALINA_HOME/webapps/$WAR_NAME/WEB-INF/
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment