|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# If the Liberty server name is not defaultServer and defaultServer still exists migrate the contents |
| 4 | +if [ "$SERVER_NAME" != "defaultServer" ] && [ -d "/opt/ibm/wlp/usr/servers/defaultServer" ]; then |
| 5 | + # Create new Liberty server |
| 6 | + /opt/ibm/wlp/bin/server create >/tmp/serverOutput |
| 7 | + rc=$? |
| 8 | + if [ $rc -ne 0 ]; then |
| 9 | + cat /tmp/serverOutput |
| 10 | + rm /tmp/serverOutput |
| 11 | + exit $rc |
| 12 | + fi |
| 13 | + rm /tmp/serverOutput |
| 14 | + |
| 15 | + # Verify server creation |
| 16 | + if [ ! -d "/opt/ibm/wlp/usr/servers/$SERVER_NAME" ]; then |
| 17 | + echo "The server name contains a character that is not valid." |
| 18 | + exit 1 |
| 19 | + fi |
| 20 | + chmod -R g+w /opt/ibm/wlp/usr/servers/$SERVER_NAME |
| 21 | + |
| 22 | + # Delete old symlinks |
| 23 | + rm /opt/ibm/links/output |
| 24 | + rm /opt/ibm/links/config |
| 25 | + |
| 26 | + # Add new output folder symlink and resolve group write permissions |
| 27 | + mkdir -p $WLP_OUTPUT_DIR/$SERVER_NAME |
| 28 | + ln -s $WLP_OUTPUT_DIR/$SERVER_NAME /opt/ibm/links/output |
| 29 | + chmod g+w $WLP_OUTPUT_DIR/$SERVER_NAME |
| 30 | + mkdir -p $WLP_OUTPUT_DIR/$SERVER_NAME/resources |
| 31 | + mkdir -p $WLP_OUTPUT_DIR/$SERVER_NAME/workarea |
| 32 | + mkdir -p $WLP_OUTPUT_DIR/$SERVER_NAME/logs |
| 33 | + chmod -R g+w $WLP_OUTPUT_DIR/$SERVER_NAME/workarea |
| 34 | + chmod -R g+w,o-rwx $WLP_OUTPUT_DIR/$SERVER_NAME/resources |
| 35 | + chmod -R g+w,o-rwx $WLP_OUTPUT_DIR/$SERVER_NAME/logs |
| 36 | + |
| 37 | + # Hand over the SCC |
| 38 | + if [ "$OPENJ9_SCC" = "true" ] && [ -d "/opt/ibm/wlp/output/defaultServer/.classCache" ]; then |
| 39 | + mv /opt/ibm/wlp/output/defaultServer/.classCache $WLP_OUTPUT_DIR/$SERVER_NAME/ |
| 40 | + fi |
| 41 | + rm -rf /opt/ibm/wlp/output/defaultServer |
| 42 | + |
| 43 | + # Add new server symlink and populate folder |
| 44 | + mv /opt/ibm/wlp/usr/servers/defaultServer/* /opt/ibm/wlp/usr/servers/$SERVER_NAME/ |
| 45 | + ln -s /opt/ibm/wlp/usr/servers/$SERVER_NAME /opt/ibm/links/config |
| 46 | + mkdir -p /config/configDropins/defaults |
| 47 | + mkdir -p /config/configDropins/overrides |
| 48 | + chmod -R g+w /config |
| 49 | + |
| 50 | + rm -rf /opt/ibm/wlp/usr/servers/defaultServer |
| 51 | +fi |
| 52 | + |
| 53 | +echo "configure-liberty.sh script has been run" > /opt/ibm/wlp/configure-liberty.log |
| 54 | +exit 0 |
0 commit comments