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