# \[newbie\] How to make a node-red flow for this bash-command

**URL:** <https://discourse.nodered.org/t/newbie-how-to-make-a-node-red-flow-for-this-bash-command/31834>\
**Category:** General\
**Created:** [21 August 2020 13:36 UTC](https://discourse.nodered.org/t/newbie-how-to-make-a-node-red-flow-for-this-bash-command/31834 "2020-08-21T13:36:07Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![hugocoolens](https://avatars.discourse-cdn.com/v4/letter/h/e95f7d/32.png) [@hugocoolens](https://discourse.nodered.org/u/hugocoolens)\
**Post date:** [21 August 2020 13:36 UTC](https://discourse.nodered.org/t/newbie-how-to-make-a-node-red-flow-for-this-bash-command/31834/1 "2020-08-21T13:36:08Z")

</div>

I'm trying to make the following command work in node-red:  
/usr/bin/mpg321 [http://progressive-audio.lwc.vrtcdn.be/content/fixed/11\_11niws-snip\_lo.mp3](http://progressive-audio.lwc.vrtcdn.be/content/fixed/11_11niws-snip_lo.mp3)

It doesn't seem a matter of just putting the command in an exec-node...  
How should I proceed?

kind regards,  
Hugo

---

<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:** [21 August 2020 13:41 UTC](https://discourse.nodered.org/t/newbie-how-to-make-a-node-red-flow-for-this-bash-command/31834/2 "2020-08-21T13:41:18Z")

</div>

Normally it should be just that simple but you did mention in another post that your running node-red in a docker container, am i right or am i confusing things?  
If this is the case i’m not sure if Nodered has excess to mpg321 if it’s installed outside of the container.  
But to narrow it down connect a debug node to all 3 outputs of the exec node and show us the outputs you get when you try to run the command.

---

<div class="post-metadata">

**Author:** ![ArneR](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/arner/32/95658_2.png) [@ArneR](https://discourse.nodered.org/u/ArneR)\
**Post date:** [21 August 2020 13:42 UTC](https://discourse.nodered.org/t/newbie-how-to-make-a-node-red-flow-for-this-bash-command/31834/3 "2020-08-21T13:42:22Z")

</div>

Hey Hugo!

Do you want to "run" it in dashboard? If yes:  
You could make an UI-template, you just need to press "play".

```auto
<audio controls>
  <source src="http://progressive-audio.lwc.vrtcdn.be/content/fixed/11_11niws-snip_lo.mp3" type="audio/mpeg">
</audio>

```

Looks like:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/7/1715444e0294c6729134ff3d08d92bc464313216.png)

Flow:

```auto
[{"id":"22ac405d.d244c","type":"ui_template","z":"24d31ef4.bdf632","group":"51404579.1d62dc","name":"","order":3,"width":0,"height":0,"format":"<audio controls>\n <source src=\"http://progressive-audio.lwc.vrtcdn.be/content/fixed/11_11niws-snip_lo.mp3\" type=\"audio/mpeg\">\n</audio>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":1950,"y":2020,"wires":[[]]},{"id":"51404579.1d62dc","type":"ui_group","z":"","name":"Persoonsgegevens","tab":"42c0724c.82676c","order":1,"disp":true,"width":"6","collapse":false},{"id":"42c0724c.82676c","type":"ui_tab","z":"","name":"Aanmelden","icon":"group","order":1,"disabled":false,"hidden":false}]

```

Arne

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [21 August 2020 14:10 UTC](https://discourse.nodered.org/t/newbie-how-to-make-a-node-red-flow-for-this-bash-command/31834/4 "2020-08-21T14:10:22Z")

</div>

Check all three outputs from the exec node to see if there are any clues about what is going on. Also make sure that you do not have Append Payload set in the exec node (unless you want it).

---

<div class="post-metadata">

**Author:** ![hugocoolens](https://avatars.discourse-cdn.com/v4/letter/h/e95f7d/32.png) [@hugocoolens](https://discourse.nodered.org/u/hugocoolens)\
**Post date:** [21 August 2020 14:21 UTC](https://discourse.nodered.org/t/newbie-how-to-make-a-node-red-flow-for-this-bash-command/31834/5 "2020-08-21T14:21:43Z")

</div>

> Normally it should be just that simple but you did mention in another post that your running node-red in a docker container, am i right or am i confusing things?  
> If this is the case i’m not sure if Nodered has excess to mpg321 if it’s installed outside of the container.  
> But to narrow it down connect a debug node to all 3 outputs of the exec node and show us the outputs you get when you try to run the command.

This is the output you asked for:

> code: 127
> 
> message: "Command failed: /usr/bin/mpg321 [http://progressive-audio.lwc.vrtcdn.be/content/fixed/11\_11niws-snip\_lo.mp3↵/bin/bash:](http://progressive-audio.lwc.vrtcdn.be/content/fixed/11_11niws-snip_lo.mp3%E2%86%B5/bin/bash:) /usr/bin/mpg321: No such file or directory↵"

Probably again something which has to do with the docker containers?  
The strange thing is that Node-RED as such is able to play the stream as suggested by ArneR (who withdraw his answer a few seconds after I imported his flow...)  
You can see this in this flow:

`[{"id":"b5c9031e.3f6cd","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"3892de81.b1aeaa","type":"ui_template","z":"b5c9031e.3f6cd","group":"ca08eeb9.434f68","name":"Jongste Nieuws","order":1,"width":0,"height":0,"format":"<audio controls>\n <source src=\"http://progressive-audio.lwc.vrtcdn.be/content/fixed/11_11niws-snip_lo.mp3\" type=\"audio/mpeg\">\n</audio>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":700,"y":320,"wires":[[]]},{"id":"f8843bb4.5455d8","type":"exec","z":"b5c9031e.3f6cd","command":"/usr/bin/mpg321 http://progressive-audio.lwc.vrtcdn.be/content/fixed/11_11niws-snip_lo.mp3","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":560,"y":200,"wires":[["ab817b9e.05b938"],["ab817b9e.05b938"],["ab817b9e.05b938"]]},{"id":"82de2858.ddeec8","type":"inject","z":"b5c9031e.3f6cd","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":220,"wires":[["f8843bb4.5455d8"]]},{"id":"ab817b9e.05b938","type":"debug","z":"b5c9031e.3f6cd","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1040,"y":180,"wires":[]},{"id":"ca08eeb9.434f68","type":"ui_group","z":"","name":"Group 1","tab":"407e1078.7c1238","order":1,"disp":true,"width":"6","collapse":false},{"id":"407e1078.7c1238","type":"ui_tab","z":"","name":"Home","icon":"dashboard","order":7,"disabled":false,"hidden":false}]`

kind regards,  
hugo

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [21 August 2020 14:24 UTC](https://discourse.nodered.org/t/newbie-how-to-make-a-node-red-flow-for-this-bash-command/31834/6 "2020-08-21T14:24:12Z")

</div>

> [@hugocoolens](#):
>
> /usr/bin/mpg321: No such file or directory

As suggested, I believe you cannot access /usr/bin outside the docker container, so unless you have installed that application inside the container then I think it will not work.

---

<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:** [21 August 2020 14:38 UTC](https://discourse.nodered.org/t/newbie-how-to-make-a-node-red-flow-for-this-bash-command/31834/7 "2020-08-21T14:38:52Z")

</div>

> [@hugocoolens](#):
>
> The strange thing is that Node-RED as such is able to play the stream as suggested by ArneR

Yes this is because what @ArneR suggested is not happening on the machine Nodered is running on but instead on the machine that you access the dashboard from as that way is purely a front end thing where you are utilizing the playback capabilities of your browser to directly play the stream without ever actually using the machine nodered runs on.

> [@Colin](#):
>
> I believe you cannot access /usr/bin outside the docker container, so unless you have installed that application inside the container then I think it will not work.

Yes looks like I suggested. You would have to install mpg321 inside the container as this is exactly what docker does, it gives you an isolated standalone container to run things that can be very limiting in the ways that you can interact with the host system.

---

<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:** [20 October 2020 14:38 UTC](https://discourse.nodered.org/t/newbie-how-to-make-a-node-red-flow-for-this-bash-command/31834/8 "2020-10-20T14:38:53Z")

</div>

Closed on 20 October 2020 14:38 UTC

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