Skip to content

Commit

Permalink
improve stop routine (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
hobbyquaker committed Apr 16, 2019
1 parent 1ebf7a7 commit 7b56d79
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
15 changes: 11 additions & 4 deletions addon_files/redmatic/bin/redmatic
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,21 @@ Stop () {
if [ "$PSPID" != "" ]
then
echo -n "Stopping Node-RED: "
logger -t redmatic -p daemon.info "Stopping Node-RED"
killall redmaticLoader 2>/dev/null
kill -SIGINT $PSPID 2>/dev/null
if [ $? -ne "0" ]
sleep 2
if kill -0 $PSPID 2> /dev/null
then
sleep 3
kill -KILL $PSPID 2>/dev/null
sleep 4
if kill -0 $PSPID 2> /dev/null
then
logger -t redmatic -p daemon.warn "Killing Node-RED"
kill -SIGKILL $PSPID 2>/dev/null
fi
fi
echo "OK"
logger -t redmatic -p daemon.info "Stopping Node-RED"
logger -t redmatic -p daemon.info "Node-RED stopped"
return 0
else
echo "Node-RED not running"
Expand Down Expand Up @@ -89,6 +95,7 @@ Start () {
if [ "$PSPID" != "" ]
then
echo "Node-RED already running"
logger -t redmatic -p daemon.error "cant start - already running"
exit 1
else
echo -n "Starting Node-RED: "
Expand Down
4 changes: 2 additions & 2 deletions addon_files/redmatic/www/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -561,10 +561,10 @@ $(document).ready(() => {
url: `service.cgi?sid=${sid}&cmd=restart`,
success: data => {
if (data.match(/Starting Node-RED: OK/)) {
psInterval = 2000;
psInterval = 1000;
setTimeout(() => {
ps();
}, 6000);
}, 1000);
alert($alertExec);
} else {
alert($alertError);
Expand Down

0 comments on commit 7b56d79

Please sign in to comment.