blob: 9d0591a476156bbef61274818d55fa9561bb59c8 [file] [log] [blame]
Timoney, Daniel (dt5972)324ee362017-02-15 10:37:53 -05001tbold=$(tput setf 3)
2bold=$(tput setf 2)
3bold1=$(tput setf 2)
4offbold=$(tput rmso;tput sgr0)
5
6function pad {
7 #echo "1 is $1 2 is $2"
8 if [ "$1" == "" ]
9 then
10 $1 = "";
11 fi
12 let count=0
13 curr_len=`expr length "$1"`
14 let space_length=$2-$curr_len
15 spaces=""
16 while [ $count -lt $space_length ]
17 do
18 spaces="$spaces "
19 let count=$count+1
20 done
21 echo "$1$spaces"
22}
23releaseDir=""
24if [ "$#" == "1" ]
25then
26 releaseDir="$1"
27fi
28
29if [ -e "releases/${releaseDir}/customSettings.js" ]
30then
31 port=$(cat releases/${releaseDir}/customSettings.js|grep uiPort|sed -e 's/[, ]//g'|cut -d: -f2)
32 kill $(cat releases/${releaseDir}/logs/process_pid 2>/dev/null) >/dev/null 2>&1
33 if [ "$?" != "0" ]
34 then
35 #kill only if its a node-red process
36 processPid=$(netstat -upltn 2>/dev/null|grep -w $port|awk '{print $NF}'|sed -e 's%/node-red%%g')
37 kill $processPid 2>/dev/null
38 echo "http://localhost:$port ---- STOPPED"
39 ./show_status|grep -w "${releaseDir}"
40 else
41 echo "http://localhost:$port ---- STOPPED"
42 ./show_status|grep -w "${releaseDir}"
43 fi
44else
45 if [ "$releaseDir" != "" ]
46 then
47 echo "Release Directory ${releaseDir} not setup.";
48 else
49 echo "Usage:$0 releaseDirName"
50 fi
51fi