Skip to content

Commit

Permalink
add disable http server flag
Browse files Browse the repository at this point in the history
  • Loading branch information
jfryman committed Jul 16, 2015
1 parent be2d807 commit e637bfa
Showing 1 changed file with 33 additions and 21 deletions.
54 changes: 33 additions & 21 deletions tools/st2ctl
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,11 @@ function st2start_classic(){
else
service mistral start
fi
(cd /opt/stackstorm/static/webui && nohup python -m SimpleHTTPServer $WEBUI_PORT) &>> ${WEBUI_LOG_FILE} &

# Only run WebUI HTTP Server if flag is not set
if [ -z "${ST2_DISABLE_HTTPSERVER}" ]; then
(cd /opt/stackstorm/static/webui && nohup python -m SimpleHTTPServer $WEBUI_PORT) &>> ${WEBUI_LOG_FILE} &
fi
}

function st2stop_classic(){
Expand All @@ -209,16 +213,20 @@ function st2stop_classic(){
fi
elif [[ "${COM}" == "st2web" ]]
then
PID=`ps ax | grep -v grep | egrep "SimpleHTTPServer $WEBUI_PORT\$" | awk '{print $1}'`
if [[ ! -z $PID ]]
then
for p in $PID
do
echo "Killing ${COM} PID: ${p}"
kill $p
done
if [ -z "${ST2_DISABLE_HTTPSERVER}" ]; then
PID=`ps ax | grep -v grep | egrep "SimpleHTTPServer $WEBUI_PORT\$" | awk '{print $1}'`
if [[ ! -z $PID ]]
then
for p in $PID
do
echo "Killing ${COM} PID: ${p}"
kill $p
done
else
echo "${COM} is not running"
fi
else
echo "${COM} is not running"
echo "*Built-in WebUI HTTP Server has been disabled*"
fi
else
ALT_COM=`service_map $COM`
Expand Down Expand Up @@ -265,17 +273,21 @@ function restart_component_classic() {
fi
elif [[ "${COM}" == "st2web" ]]
then
PID=`ps ax | grep -v grep | egrep "SimpleHTTPServer $WEBUI_PORT\$" | awk '{print $1}'`
if [[ ! -z $PID ]]
then
for p in $PID
do
kill $p
sleep 1
(cd /opt/stackstorm/static/webui && nohup python -m SimpleHTTPServer $WEBUI_PORT) &>> ${WEBUI_LOG_FILE} &
done
if [ -z "${ST2_DISABLE_HTTPSERVER}" ]; then
PID=`ps ax | grep -v grep | egrep "SimpleHTTPServer $WEBUI_PORT\$" | awk '{print $1}'`
if [[ ! -z $PID ]]
then
for p in $PID
do
kill $p
sleep 1
(cd /opt/stackstorm/static/webui && nohup python -m SimpleHTTPServer $WEBUI_PORT) &>> ${WEBUI_LOG_FILE} &
done
else
echo "${COM} is not running"
fi
else
echo "${COM} is not running"
echo "*Built-in WebUI HTTP Server has been disabled*"
fi
else
PID=`ps ax | grep -v grep | grep -v st2ctl | egrep "${COM}|${ALT_COM}" | awk '{print $1}'`
Expand Down Expand Up @@ -350,7 +362,7 @@ function getpids(){

for COM in $COMPONENTS
do
if [[ "${COM}" == "st2web" ]]
if [[ "${COM}" == "st2web" && -z "${ST2_DISABLE_HTTPSERVER}" ]]
then
PID=`ps ax | grep -v grep | egrep "SimpleHTTPServer $WEBUI_PORT\$" | awk '{print $1}'`
else
Expand Down

0 comments on commit e637bfa

Please sign in to comment.