# Status of an Exec node

**URL:** <https://discourse.nodered.org/t/status-of-an-exec-node/67809>\
**Category:** General\
**Created:** [16 September 2022 14:01 UTC](https://discourse.nodered.org/t/status-of-an-exec-node/67809 "2022-09-16T14:01:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![FeliceM](https://avatars.discourse-cdn.com/v4/letter/f/ec9cab/32.png) [@FeliceM](https://discourse.nodered.org/u/FeliceM)\
**Post date:** [16 September 2022 14:01 UTC](https://discourse.nodered.org/t/status-of-an-exec-node/67809/1 "2022-09-16T14:01:40Z")

</div>

Hi,  
I am try to get the status of an exec-node using the status-node.  
For some reason I can catch when the node is killed but not when it has a pid. When I start the exec node, the function attached to the status node immediately jumps to the last statement "unknown process status".  
This is a simplified version of my flow. I have omitted the exec node because it would also need the python script attached to it.  
However the status node is clearly outputting:

- "pid:1234" when in execution and:
- "killed" when stopped.  
do you see anything wrong that cause the pid:1234 not be intercepted

```auto
var test = msg.status.text;

if (test.includes('pid:')) { 
  msg.payload="Process running"
}
if (test.includes('kill')) { 
  msg.payload="Process stopped"
}
else {
    msg.payload="unknow process status"
}
return msg;

```

```auto
[{"id":"ee1921195e1f3b6c","type":"status","z":"c77ba1683e345234","name":"ExecStatus","scope":["c4ff59a7c876123f"],"x":1090,"y":500,"wires":[["d78095b461723415","902fd20e2c38a409"]]},{"id":"cac9c0b90cab337b","type":"debug","z":"c77ba1683e345234","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1470,"y":480,"wires":[]},{"id":"d78095b461723415","type":"function","z":"c77ba1683e345234","name":"","func":"\nvar test = msg.status.text;\n\nif (test.includes('pid:')) { \n msg.payload=\"Process running\"\n}\n\nif (test.includes('kill')) { \n msg.payload=\"Process stopped\"\n}\n\nelse {\n msg.payload=\"unknow process status\"\n}\n\n\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1300,"y":480,"wires":[["cac9c0b90cab337b"]]}]

```

Thanks for helping

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [16 September 2022 14:36 UTC](https://discourse.nodered.org/t/status-of-an-exec-node/67809/2 "2022-09-16T14:36:50Z")

</div>

the middle test probably wants to be an `else if` .  
Currently the first test may or may not set the payload... but then the second if will then overwrite that with the stopped or unknown message.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [30 September 2022 14:36 UTC](https://discourse.nodered.org/t/status-of-an-exec-node/67809/3 "2022-09-30T14:36:52Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
