# Reading the output of a script

**URL:** <https://discourse.nodered.org/t/reading-the-output-of-a-script/25835>\
**Category:** General\
**Created:** [30 April 2020 20:09 UTC](https://discourse.nodered.org/t/reading-the-output-of-a-script/25835 "2020-04-30T20:09:13Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dclear](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dclear/32/9107_2.png) [@dclear](https://discourse.nodered.org/u/dclear)\
**Post date:** [30 April 2020 20:09 UTC](https://discourse.nodered.org/t/reading-the-output-of-a-script/25835/1 "2020-04-30T20:09:13Z")

</div>

Hi! 🙂  
So I'm successfully (to my surprise as I'm such a noob) reading the output of a PHP script and doing different things with the output depending on the content. I'm very happy. It's working. But the script is told to initialise by a timestamp which is set to only run once and then not repeat.

Somewhere down the line obviously something is going to go wrong and the 'link' between node-red and that script running will be broken.

How do I go about checking for that and engineering in restarting the script as and when needed?

many thanks! 🙂 🙂

---

<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:** [30 April 2020 20:34 UTC](https://discourse.nodered.org/t/reading-the-output-of-a-script/25835/2 "2020-04-30T20:34:50Z")

</div>

Look at the node-red-node-daemon node. Which is similar to exec but meant for long running processes, and does restarts.

---

<div class="post-metadata">

**Author:** ![dclear](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dclear/32/9107_2.png) [@dclear](https://discourse.nodered.org/u/dclear)\
**Post date:** [1 May 2020 14:25 UTC](https://discourse.nodered.org/t/reading-the-output-of-a-script/25835/3 "2020-05-01T14:25:31Z")

</div>

Thanks dceejay - I have tried the daemon node but weirdly it refuses to work, occasionally it will spit out some genuine output from the PHP script but mostly it just says "Command not found" which is odd because it's the exact same command which works a treat from the 'exec' node? Odd. Shame because I'd love its restarting/monitoring abilities...

 ![daemon no workie](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/e/6e20df424aea7ebcdf5771928e392f3de53651bd.png)

---

<div class="post-metadata">

**Author:** ![JGKK](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jgkk/32/18515_2.png) [@JGKK](https://discourse.nodered.org/u/JGKK)\
**Post date:** [1 May 2020 14:55 UTC](https://discourse.nodered.org/t/reading-the-output-of-a-script/25835/4 "2020-05-01T14:55:49Z")

</div>

Have you tried to only put php in the command part and everything else in the argument field. That made me struggle with the daemon node when I first used it. So like this:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/7/7711d612f58ca3f5413fb8ebf73d68472a5cddbf.jpeg)

---

<div class="post-metadata">

**Author:** ![dclear](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dclear/32/9107_2.png) [@dclear](https://discourse.nodered.org/u/dclear)\
**Post date:** [16 June 2020 11:41 UTC](https://discourse.nodered.org/t/reading-the-output-of-a-script/25835/5 "2020-06-16T11:41:54Z")

</div>

It's really strange. What works as an exec node does not work for a daemon node even if I do as you suggest and put php in the command field and the path in the argument field.

 ![doesn't work](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/c/fc9e2ee9691062d5f64926ca937224b27d051531.png) ![works](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/8/9894dc3e82674762d65d1d4091de526b66b4b732.png)

---

<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 June 2020 12:05 UTC](https://discourse.nodered.org/t/reading-the-output-of-a-script/25835/6 "2020-06-16T12:05:09Z")

</div>

what does the error on pin2 and / or pin 3 say ?

Also asked in [Exec node seems to fail, go to Rc:1](https://discourse.nodered.org/t/exec-node-seems-to-fail-go-to-rc-1/28398)  
so closing this one

---

<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 June 2020 12:06 UTC](https://discourse.nodered.org/t/reading-the-output-of-a-script/25835/7 "2020-06-16T12:06:40Z")

</div>


