summaryrefslogtreecommitdiffstats
path: root/dgbuilder/stop.sh
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2017-03-31 17:47:19 -0400
committerDan Timoney <dtimoney@att.com>2017-03-31 18:06:03 -0400
commitb2175581c55981e2eb039f3543baffe76d13394d (patch)
tree3c12aec883ac2138516e977debb5853c124ebedd /dgbuilder/stop.sh
parent6a1dc58085031a5aaccab2e0bb425f825e24ec80 (diff)
[SDNC-5] Rebase sdnc-oam
Port to OpenDaylight Boron and sync updates since 16.10 Change-Id: I9f6febe0bd3d50c3d27c775e5a41806ee3d2e6cb Signed-off-by: Dan Timoney <dtimoney@att.com> Former-commit-id: c7fb7db31a50d5f0005251d41f497fbd4fb2ae4b
Diffstat (limited to 'dgbuilder/stop.sh')
-rwxr-xr-xdgbuilder/stop.sh52
1 files changed, 52 insertions, 0 deletions
diff --git a/dgbuilder/stop.sh b/dgbuilder/stop.sh
new file mode 100755
index 00000000..b67babc0
--- /dev/null
+++ b/dgbuilder/stop.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+tbold=$(tput setf 3)
+bold=$(tput setf 2)
+bold1=$(tput setf 2)
+offbold=$(tput rmso;tput sgr0)
+
+function pad {
+ #echo "1 is $1 2 is $2"
+ if [ "$1" == "" ]
+ then
+ $1 = "";
+ fi
+ let count=0
+ curr_len=`expr length "$1"`
+ let space_length=$2-$curr_len
+ spaces=""
+ while [ $count -lt $space_length ]
+ do
+ spaces="$spaces "
+ let count=$count+1
+ done
+ echo "$1$spaces"
+}
+releaseDir=""
+if [ "$#" == "1" ]
+then
+ releaseDir="$1"
+fi
+
+if [ -e "releases/${releaseDir}/customSettings.js" ]
+then
+ port=$(cat releases/${releaseDir}/customSettings.js|grep uiPort|sed -e 's/[, ]//g'|cut -d: -f2)
+ kill $(cat releases/${releaseDir}/logs/process_pid 2>/dev/null) >/dev/null 2>&1
+ if [ "$?" != "0" ]
+ then
+ #kill only if its a node-red process
+ processPid=$(netstat -upltn 2>/dev/null|grep -w $port|awk '{print $NF}'|sed -e 's%/node-red%%g')
+ kill $processPid 2>/dev/null
+ echo "http://localhost:$port ---- STOPPED"
+ ./show_status.sh|grep -w "${releaseDir}"
+ else
+ echo "http://localhost:$port ---- STOPPED"
+ ./show_status.sh|grep -w "${releaseDir}"
+ fi
+else
+ if [ "$releaseDir" != "" ]
+ then
+ echo "Release Directory ${releaseDir} not setup.";
+ else
+ echo "Usage:$0 releaseDirName"
+ fi
+fi