X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=example%2Fdiameter%2Flauncher%2FDEPLOY.sh;h=d3725d351e339688f384b8fa9fd8fd9e0e4e74e8;hb=2ddc4abd3627f5f5b4df32de199f364aa3844491;hp=f1d1538f90c8dd84ee62d351f82c49c6c9e3eca9;hpb=6b3c0d5e652726b5034fa595bc020476862c948f;p=anna.git diff --git a/example/diameter/launcher/DEPLOY.sh b/example/diameter/launcher/DEPLOY.sh index f1d1538..d3725d3 100755 --- a/example/diameter/launcher/DEPLOY.sh +++ b/example/diameter/launcher/DEPLOY.sh @@ -1,14 +1,18 @@ #!/bin/bash -# Functions & variables +############# +# VARIABLES # +############# SETUPS_DIR=../../../source/diameter/stack/setups MSGDTD=../../../include/anna/diameter/codec/message.dtd DCTDTD=../../../include/anna/diameter/stack/dictionary.dtd BASE_PROT=commands_baseProtocol.xml EXEC=./debug/example_diameter_launcher DPATH_dflt=$HOME/ADL -RESOURCES_DIR=resources +############# +# FUNCTIONS # +############# _exit () { echo echo $1 @@ -16,30 +20,32 @@ _exit () { exit } +# $1: deployment type createRunScript () { - echo "#!/bin/bash" > run.sh - echo "EXE=\`cat .exe 2>/dev/null\`" >> run.sh - echo "STARTED=\`pgrep \$EXE2>/dev/null\`" >> run.sh - echo "[ \$? -eq 0 ] && { echo \"Already started!\"; echo \"\$STARTED\" ; exit 1 ; }" >> run.sh - echo "./pre-start.sh" >> run.sh - echo "> launcher.traces" >> run.sh - echo "EXE=\"./ADL-launcher\"" >> run.sh - echo "echo \$EXE > .exe" >> run.sh - echo >> run.sh - echo -n "\$EXE " >> run.sh - for i in `cat args.txt | grep -v "^#"` - do - echo -n "$i " >> run.sh - done - echo -n "-cntDir counters " >> run.sh - echo "&" >> run.sh + # Basic launcher 'run.sh' will be created at deployment configuration: + [ "$1" = "b" ] && return + [ "$1" = "a" ] && exe=ADL-launcher + [ "$1" = "f" ] && { exe=ADL-ftclient ; ln -s ADL-launcher $exe ; } + + cat << EOF > run.sh +#!/bin/bash +cd \`dirname \$0\` +EXE=$exe +STARTED=\`pgrep \$EXE 2>/dev/null\` +[ \$? -eq 0 ] && { echo "Already started!"; echo "\$STARTED" ; exit 1 ; } +./pre-start.sh +0> launcher.traces +# Execution line: +./\$EXE -cntDir counters $(for i in `cat args.txt | grep -v "^#"`; do echo -n "$i "; done)& +echo \$! > .pid +EOF + chmod a+x run.sh rm args.txt } createDictionaryPaths () { - for i in stacks/*commands*xml do stacks/dependence.sh $i >/dev/null @@ -65,6 +71,7 @@ createDictionaryPaths () { ############# # EXECUTION # ############# +cd `dirname $0` echo echo "---------------------------------------" echo "Anna Diameter Launcher (ADL) deployment" @@ -80,10 +87,32 @@ echo "Basic checkings ..." [ ! -d $SETUPS_DIR ] && _exit "Diameter stacks not found ($SETUPS_DIR). Perhaps you executed this script out of its parent path." echo -echo "Deploy (f)ull version or (l)ite version [l]:" -read deploy_type -[ "$deploy_type" = "" ] && deploy_type=l -[ "$deploy_type" = "l" ] && RESOURCES_DIR=resources_lite +echo "Deploy one of these versions:" +echo +echo " (a)dvanced version: includes burst management script and templates for different scenarios. Automatic configuration during start." +echo " (b)asic version: 4 types of launcher (client, server, balancer, dummy), lightly configured and managed through SIGURS2 method." +echo " (f)unction test client: special client with regexp scheduler script based on splitted traffic logs." +echo +echo "Input option [b]:" +read option +[ "$option" = "" ] && option=b +case $option in + a) + RESOURCES_DIR=resources/advanced + ;; + + b) + RESOURCES_DIR=resources/basic + ;; + + f) + RESOURCES_DIR=resources/ft-client + ;; + + *) + _exit "Unknown option !!" + ;; +esac echo "Copying ..." mkdir -p $DPATH @@ -91,7 +120,7 @@ mkdir -p $DPATH/stacks mkdir -p $DPATH/DTDs mkdir -p $DPATH/counters cp $EXEC $DPATH/ADL-launcher -cp -r $RESOURCES_DIR/* $DPATH +cp -rL $RESOURCES_DIR/* $DPATH cp $SETUPS_DIR/*xml $DPATH/stacks cp $SETUPS_DIR/*sh $DPATH/stacks cp $SETUPS_DIR/readme.txt $DPATH/stacks @@ -100,7 +129,7 @@ cp $DCTDTD $DPATH/DTDs echo "Preparing ..." cd $DPATH -[ "$deploy_type" != "l" ] && createRunScript +createRunScript $option createDictionaryPaths cd - >/dev/null