Skip to content

Commit 6db440d

Browse files
committed
fix restart cmd (fix #28)
1 parent 886b3b8 commit 6db440d

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

addon_files/redmatic/bin/redmatic

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,21 @@ Stop () {
1919
PSPID=`ps -o pid,comm,args | awk '{if($3 == "node-red" || $4 ~ /node-red/){print $1}}'`
2020
if [ "$PSPID" != "" ]
2121
then
22-
echo -n "Stopping Node-RED: "
23-
kill $1 $PSPID 2>/dev/null || true
24-
sleep 1
25-
kill -0 $PSPID 2>/dev/null
26-
if [ $? -eq 0 ]
27-
then
28-
sleep 3
29-
kill -KILL $PSPID 2>/dev/null
30-
fi
31-
logger -t homematic -p user.info "stopped node-red"
32-
echo "OK"
22+
echo -n "Stopping Node-RED: "
23+
kill $1 $PSPID 2>/dev/null || true
24+
sleep 1
25+
kill -0 $PSPID 2>/dev/null
26+
if [ $? -eq 0 ]
27+
then
28+
sleep 3
29+
kill -KILL $PSPID 2>/dev/null
30+
fi
31+
logger -t homematic -p user.info "stopped node-red"
32+
echo "OK"
33+
return 0
3334
else
3435
echo "Node-RED not running"
35-
exit 1
36+
return 1
3637
fi
3738
}
3839

@@ -53,7 +54,7 @@ Start () {
5354
case "$1" in
5455

5556
stop)
56-
Stop
57+
Stop || exit 1
5758
;;
5859

5960
start)

0 commit comments

Comments
 (0)