1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | #!/bin/bash # # 3DS Server CLI tool script. usage() { cat <<EOF This script is used to start and pass commands to 3DS Server CLI Tool. Usage: $0 <options> < command > <argument> List available commands: $0 <options> help Single command usage: $0 <options> help < command > OPTIONS: -c The configuration home directory EOF } # Set defaults for command line arguments THREEDS_CLI_TOOL_HOME=$( cd $( dirname "$0" )/..; pwd ) THREEDS_TOOL_JAR= "$THREEDS_CLI_TOOL_HOME/lib/nca-3dss-cli-tool.jar" THREEDS_CLI_TOOL_CONFIG_HOME= "$THREEDS_CLI_TOOL_HOME/conf/" while getopts ":c:" OPTION; do case ${OPTION} in c) THREEDS_CLI_TOOL_CONFIG_HOME=$OPTARG ;; \?) echo "Invalid option: $OPTARG" 1>&2 ;; :) echo "Invalid option: $OPTARG requires an argument" 1>&2 ;; esac done shift $((OPTIND -1)) # Set variables # if THREEDS_CLI_TOOL_CONFIG_HOME is a directory, add / here if [[ -d $THREEDS_CLI_TOOL_CONFIG_HOME ]]; then config_length=${ #THREEDS_CLI_TOOL_CONFIG_HOME} last_char=${THREEDS_CLI_TOOL_CONFIG_HOME:config_length-1:1} [ $last_char != "/" ] && THREEDS_CLI_TOOL_CONFIG_HOME= "$THREEDS_CLI_TOOL_CONFIG_HOME/" ; else echo "$THREEDS_CLI_TOOL_CONFIG_HOME is not a directory" ; exit 1; fi COMMAND=$1 ARGUMENT=$2 JAVA_OPTS= "-Dspring.config.name=application -Dspring.config.additional-location=$THREEDS_CLI_TOOL_CONFIG_HOME" java $JAVA_OPTS -jar $THREEDS_TOOL_JAR $COMMAND $ARGUMENT |