Created
April 1, 2019 18:03
-
-
Save ern/4aeb2adc848938c5a5524e404614c953 to your computer and use it in GitHub Desktop.
Sakai Tomcat Scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/local/bin/zsh | |
| source bin/common.sh | |
| if [ -n "$(ls -A $COMPONENTS)" ]; then | |
| echo "Removing $COMPONENTS" | |
| rm -rf $COMPONENTS/* | |
| fi | |
| if [ -n "$(ls -A $LIB)" ]; then | |
| echo "Removing $LIB" | |
| rm -rf $LIB/* | |
| fi | |
| if [ -n "$(ls -A $LOGS)" ]; then | |
| echo "Removing $LOGS" | |
| rm -rf $LOGS/* | |
| fi | |
| if [ -n "$(ls -A $TEMP)" ]; then | |
| echo "Removing $TEMP" | |
| rm -rf $TEMP/* | |
| fi | |
| if [ -n "$(ls -A $WEBAPPS)" ]; then | |
| echo "Removing $WEBAPPS" | |
| rm -rf $WEBAPPS/* | |
| fi | |
| if [ -n "$(ls -A $WORK)" ]; then | |
| echo "Removing $WORK" | |
| rm -rf $WORK/* | |
| fi | |
| if [ -n "$(ls -A $ENDORSED)" ]; then | |
| echo "Removing $ENDORSED" | |
| rm -rf $ENDORSED/* | |
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/local/bin/zsh | |
| source bin/common.sh | |
| if [ -n "$(ls -A $SAKAI_DB)" ]; then | |
| echo "Removing $SAKAI_DB" | |
| rm -rf $SAKAI_DB/* | |
| fi | |
| if [ -n "$(ls -A $SAKAI_ES)" ]; then | |
| echo "Removing $SAKAI_ES" | |
| rm -rf $SAKAI_ES/* | |
| fi | |
| if [ -n "$(ls -A $SAKAI_SAM)" ]; then | |
| echo "Removing $SAKAI_SAM" | |
| rm -rf $SAKAI_SAM* | |
| fi | |
| DB=$(echo $PROPERTIES["[email protected]"] | $GREP_CMD -oP '(?<=\/)\w+(?=\?)') | |
| echo "Drop existing database $DB" | |
| $($MYSQL_CMD -u$PROPERTIES["[email protected]"] -p$PROPERTIES["[email protected]"] -D $DB -e "DROP DATABASE $DB") | |
| echo "Create database $DB" | |
| $($MYSQL_CMD -u$PROPERTIES["[email protected]"] -p$PROPERTIES["[email protected]"] -e "CREATE DATABASE $DB DEFAULT CHARACTER SET utf8") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/local/bin/zsh | |
| # common vars used by start and stop | |
| CATALINA_HOME="$HOME/local/apache-tomcat-9.0.14" | |
| CATALINA_BASE="$HOME/local/tomcat-sakai-19x" | |
| BIN="$CATALINA_BASE/bin" | |
| COMPONENTS="$CATALINA_BASE/components" | |
| CONF="$CATALINA_BASE/conf" | |
| LIB="$CATALINA_BASE/lib" | |
| LOGS="$CATALINA_BASE/logs" | |
| SAKAI_DB="$CATALINA_BASE/sakai/db" | |
| SAKAI_ES="$CATALINA_BASE/sakai/elasticsearch" | |
| SAKAI_SAM="$CATALINA_BASE/sakai/samigo" | |
| TEMP="$CATALINA_BASE/temp" | |
| WEBAPPS="$CATALINA_BASE/webapps" | |
| WORK="$CATALINA_BASE/work" | |
| ENDORSED="$CATALINA_BASE/endorsed" | |
| TOMCAT_CMD="$CATALINA_HOME/bin/catalina.sh" | |
| MYSQL_CMD="mysql" | |
| GREP_CMD="ggrep" | |
| typeset -A PROPERTIES | |
| function readPropertyFile { | |
| if [ -f $1 ]; then | |
| while read line || [[ -n $line ]]; do | |
| key=`echo $line | cut -s -d'=' -f1` | |
| if [ -n "$key" ]; then | |
| value=`echo $line | cut -d'=' -f2-` | |
| PROPERTIES["$key"]="$value" | |
| fi | |
| done < <($GREP_CMD "^[^#].*=" $1) | |
| fi | |
| } | |
| readPropertyFile "$CATALINA_BASE/sakai/sakai.properties" | |
| readPropertyFile "$CATALINA_BASE/sakai/local.properties" | |
| readPropertyFile "$CATALINA_BASE/sakai/instance.properties" | |
| # print the properties | |
| #for k in "${(@k)PROPERTIES}"; do echo "$k --- $PROPERTIES[$k]"; done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/local/bin/zsh | |
| source bin/common.sh | |
| if [ -d "$LOGS" ]; then | |
| echo "Removing logs from $LOGS" | |
| rm -f $LOGS/* | |
| fi | |
| . $TOMCAT_CMD jpda start |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/local/bin/zsh | |
| source bin/common.sh | |
| . $TOMCAT_CMD stop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment