# Strange fails with cronplus and exec nodes

**URL:** <https://discourse.nodered.org/t/strange-fails-with-cronplus-and-exec-nodes/78881>\
**Category:** General\
**Created:** [1 June 2023 22:50 UTC](https://discourse.nodered.org/t/strange-fails-with-cronplus-and-exec-nodes/78881 "2023-06-01T22:50:45Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![LosinIt](https://avatars.discourse-cdn.com/v4/letter/l/439d5e/32.png) [@LosinIt](https://discourse.nodered.org/u/LosinIt)\
**Post date:** [1 June 2023 22:50 UTC](https://discourse.nodered.org/t/strange-fails-with-cronplus-and-exec-nodes/78881/1 "2023-06-01T22:50:45Z")

</div>

For a very long time now I have been trying to figure out what is different between the cronplus node operating on it's schedule and my clicking on its "doit" tab manually. It ALWAYS works when I click and USUALLY fails when scheduled with this:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/c/dc0a65226fd64467aaf6926017753e8223cfc3ab.png)

I thought that in time I'd see what the difference is but, hey, I'm getting old here! I've not figured out what "name or service" it's failing to find but it seems a moot point since it works when manually triggered. Can anyone see what it is???

> **Flow attached (click to reveal)**
>
> ```auto
> [
> {
> "id": "16d11b5e.b2d195",
> "type": "cronplus",
> "z": "2bc59a52.1c3956",
> "name": "19 past every hour",
> "outputField": "payload",
> "timeZone": "",
> "persistDynamic": false,
> "commandResponseMsgOutput": "output1",
> "outputs": 1,
> "options": [
> {
> "name": "19 past every hour",
> "topic": "19 past every hour",
> "payloadType": "str",
> "payload": "start",
> "expressionType": "cron",
> "expression": "19 * * * *",
> "location": "",
> "offset": "0",
> "solarType": "all",
> "solarEvents": "sunrise,sunset"
> }
> ],
> "x": 130,
> "y": 90,
> "wires": [
> [
> "e877ec10f0a573db"
> ]
> ]
> },
> {
> "id": "e877ec10f0a573db",
> "type": "exec",
> "z": "2bc59a52.1c3956",
> "command": "ssh steve@localhost \"/usr/bin/speedtest-cli --json --secure\"",
> "addpay": "",
> "append": "",
> "useSpawn": "false",
> "timer": "",
> "winHide": false,
> "oldrc": false,
> "name": "Run SpeedTest",
> "x": 410,
> "y": 90,
> "wires": [
> [
> "7ac4f5ef7db02023"
> ],
> [
> "c84f09a7584f0bd3"
> ],
> [
> "46482f09f19056b1"
> ]
> ]
> }
> ]
> 
> ```

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [1 June 2023 23:44 UTC](https://discourse.nodered.org/t/strange-fails-with-cronplus-and-exec-nodes/78881/2 "2023-06-01T23:44:16Z")

</div>

It seems highly unlikely that the cron node is to blame. I just can't see how it it would be affected? I assume you have added a debug node to see if there's any difference in the complete message when the cron node triggers v manual trigger?

---

<div class="post-metadata">

**Author:** ![LosinIt](https://avatars.discourse-cdn.com/v4/letter/l/439d5e/32.png) [@LosinIt](https://discourse.nodered.org/u/LosinIt)\
**Post date:** [2 June 2023 03:27 UTC](https://discourse.nodered.org/t/strange-fails-with-cronplus-and-exec-nodes/78881/3 "2023-06-02T03:27:05Z")

</div>

> [@Steve-Mcl](#):
>
> added a debug node

Yes but it's been a long time so I've just done it again. Here is the diff between a manual invocation (in red) and a timed one that _succeeded_! Don't it figure that it would work at this moment? 🙄 I'll post again when I get a fail.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/5/55ead1124bdaabebb118c0cda4565501c88fc2d5.png)

Perhaps I don't understand something about the Exec node but I am under the impression that the message contents don't matter one bit and that only the receipt of the message is significant. That is, of course, since I don't use any part of the incoming message contents to affect how the Exec node operates.

EDIT:

OK, just had a fail and here is the diff between the previous timed one that succeeded (in red) and the fail. I see nothing that would matter to the Exec node.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/6/46f0ae17e68df04a397df4bee4cda26e4a3033c0.png)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [2 June 2023 07:27 UTC](https://discourse.nodered.org/t/strange-fails-with-cronplus-and-exec-nodes/78881/4 "2023-06-02T07:27:09Z")

</div>

> [@LosinIt](#):
>
> I am under the impression that the message contents don't matter one bit and that only the receipt of the message is significant. That is, of course, since I don't use any part of the incoming message contents to affect how the Exec node operates

That is correct. That's why I am very sure it is unrelated.

Question:  
Since operating the button manually, your computer must obviously be fully 'awake'. When it is a scheduled event, is your computer going to sleep? I have a distant memory of individual sleep settings on network cards causing issues in the past for me. What operating system & version are you using?

---

<div class="post-metadata">

**Author:** ![LosinIt](https://avatars.discourse-cdn.com/v4/letter/l/439d5e/32.png) [@LosinIt](https://discourse.nodered.org/u/LosinIt)\
**Post date:** [2 June 2023 09:11 UTC](https://discourse.nodered.org/t/strange-fails-with-cronplus-and-exec-nodes/78881/5 "2023-06-02T09:11:00Z")

</div>

> [@Steve-Mcl](#):
>
> That is correct.

Thanks for confirming my understanding.

> [@Steve-Mcl](#):
>
> fully 'awake'.

Yes, it never suspends. This box runs all of my home automation apps.

> [@Steve-Mcl](#):
>
> operating system & version

Arch Linux which is updated at least weekly. This issue has been around for maybe even a year, so through many versions.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [2 June 2023 09:28 UTC](https://discourse.nodered.org/t/strange-fails-with-cronplus-and-exec-nodes/78881/6 "2023-06-02T09:28:43Z")

</div>

Wow your debug colour scheme is hard to read!

Can you make a simple flow that shows the issue and post it here?

---

<div class="post-metadata">

**Author:** ![LosinIt](https://avatars.discourse-cdn.com/v4/letter/l/439d5e/32.png) [@LosinIt](https://discourse.nodered.org/u/LosinIt)\
**Post date:** [2 June 2023 12:31 UTC](https://discourse.nodered.org/t/strange-fails-with-cronplus-and-exec-nodes/78881/7 "2023-06-02T12:31:13Z")

</div>

> [@jbudd](#):
>
> simple flow

The pertinent nodes were posted in my opening post.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [2 June 2023 14:44 UTC](https://discourse.nodered.org/t/strange-fails-with-cronplus-and-exec-nodes/78881/8 "2023-06-02T14:44:24Z")

</div>

OK I didn't notice the little black triangle, sorry.

I'm not familiar with exec via ssh steve@localhost ...  
I see no reason why this would make a difference but can you explain the reason for doing it like this?

Are you accessing Node-red from the Linux machine or some other desktop?  
Does it fail if you are logged in to Node-red at 19 minutes past the hour and watching the flow when it is triggered?

---

<div class="post-metadata">

**Author:** ![LosinIt](https://avatars.discourse-cdn.com/v4/letter/l/439d5e/32.png) [@LosinIt](https://discourse.nodered.org/u/LosinIt)\
**Post date:** [2 June 2023 14:50 UTC](https://discourse.nodered.org/t/strange-fails-with-cronplus-and-exec-nodes/78881/9 "2023-06-02T14:50:18Z")

</div>

> [@jbudd](#):
>
> explain the reason

NR is in Docker and this method allows access to the host's resources without mapping its filesystem into the container. It's also portable by simply changing the name after the @

> [@jbudd](#):
>
> Are you accessing Node-red from the Linux machine or some other desktop?

Desktop

> [@jbudd](#):
>
> Does it fail if you are logged in to Node-red at 19 minutes past the hour and watching the flow when it is triggered?

It matters not one way or the other.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [2 June 2023 14:58 UTC](https://discourse.nodered.org/t/strange-fails-with-cronplus-and-exec-nodes/78881/10 "2023-06-02T14:58:49Z")

</div>

Try specifying the server with speedtest-cli --server.

---

<div class="post-metadata">

**Author:** ![cameo69](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cameo69/32/66593_2.png) [@cameo69](https://discourse.nodered.org/u/cameo69)\
**Post date:** [2 June 2023 15:35 UTC](https://discourse.nodered.org/t/strange-fails-with-cronplus-and-exec-nodes/78881/11 "2023-06-02T15:35:14Z")

</div>

> [@LosinIt](#):
>
> Don't it figure that it would work at this moment? 🙄 I'll post again when I get a fail.

I am curious, does this mean it works sometimes?

Because then it is probably not the exec node that's failing.

If that is the case, is it possible that you try to run it multiple times concurrently and that it fails because some resource is locked?

---

<div class="post-metadata">

**Author:** ![LosinIt](https://avatars.discourse-cdn.com/v4/letter/l/439d5e/32.png) [@LosinIt](https://discourse.nodered.org/u/LosinIt)\
**Post date:** [2 June 2023 20:50 UTC](https://discourse.nodered.org/t/strange-fails-with-cronplus-and-exec-nodes/78881/12 "2023-06-02T20:50:00Z")

</div>

> [@cameo69](#):
>
> does this mean it works sometimes?

Yes, as stated in the original post.

> [@cameo69](#):
>
> not the exec node that's failing

I don't think the NODE is failing, per se, I think it's the COMMAND specified in the node's setup that fails but that is a distinction without a difference.

> [@cameo69](#):
>
> is it possible that you try to run it multiple times concurrently and that it fails because some resource is locked?

Thanks for the thought but I have no evidence of concurrent instances tripping over each other. I just now manually ran a 2nd instance while the 1st was in progress and they both succeeded normally so I think that rules it out.

---

<div class="post-metadata">

**Author:** ![LosinIt](https://avatars.discourse-cdn.com/v4/letter/l/439d5e/32.png) [@LosinIt](https://discourse.nodered.org/u/LosinIt)\
**Post date:** [2 June 2023 21:37 UTC](https://discourse.nodered.org/t/strange-fails-with-cronplus-and-exec-nodes/78881/13 "2023-06-02T21:37:16Z")

</div>

> [@jbudd](#):
>
> Try specifying the server with speedtest-cli --server.

You might be on to something there but it's confusing me even more. It fails every time when a server is specified in the Exec node AND from the command line on the server where NR is hosted. Running the exact same command in a terminal on my desktop (same versions of Arch Linux and speedtest-cli) it's 50/50 success/fail. When it fails...

```auto
speedtest-cli --server 15985
Retrieving speedtest.net configuration...
Testing from As-sumo-idaho (130.51.30.95)...
Retrieving speedtest.net server list...
ERROR: No matched servers: 15985

```

It succeeds from the command line every time on either host if I don't specify a server (limited number of iterations, of course).

I don't know what to make of this.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [2 June 2023 22:06 UTC](https://discourse.nodered.org/t/strange-fails-with-cronplus-and-exec-nodes/78881/14 "2023-06-02T22:06:06Z")

</div>

I don't know what to make of it either.

I think you should be trying **speedtest-cli --secure --server n** because there is recent discussion online about speedtest failing without --secure.

If I try 15985 I get No matched servers too, but then the internet thinks I'm in London. Maybe Ookla refuse connections it thinks too distant, or maybe #15985 is dead

If I use a random server from the list given by **speedtest-cli --list** (the listed servers are in London) then it seems OK.

Are you using a VPN?

---

<div class="post-metadata">

**Author:** ![LosinIt](https://avatars.discourse-cdn.com/v4/letter/l/439d5e/32.png) [@LosinIt](https://discourse.nodered.org/u/LosinIt)\
**Post date:** [2 June 2023 22:28 UTC](https://discourse.nodered.org/t/strange-fails-with-cronplus-and-exec-nodes/78881/15 "2023-06-02T22:28:54Z")

</div>

> [@jbudd](#):
>
> I think you should be trying **speedtest-cli --secure --server n** because there is recent discussion online about speedtest failing without --secure.

Actually, I do. I just didn't in that post because I hurried and grabbed the latest command where I'd left it off.

Thank you for testing!

> [@jbudd](#):
>
> Are you using a VPN?

No.

---

<div class="post-metadata">

**Author:** ![cameo69](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cameo69/32/66593_2.png) [@cameo69](https://discourse.nodered.org/u/cameo69)\
**Post date:** [3 June 2023 12:54 UTC](https://discourse.nodered.org/t/strange-fails-with-cronplus-and-exec-nodes/78881/16 "2023-06-03T12:54:44Z")

</div>

Ok, I just imported your flow. If I see correctly you are executing `ssh steve@localhost "/usr/bin/speedtest-cli --json --secure"`.  
But if you execute this within a docker container, you connect to the docker container, because localhost points to the docker container. Are you sure this is all correct?

---

<div class="post-metadata">

**Author:** ![LosinIt](https://avatars.discourse-cdn.com/v4/letter/l/439d5e/32.png) [@LosinIt](https://discourse.nodered.org/u/LosinIt)\
**Post date:** [3 June 2023 13:35 UTC](https://discourse.nodered.org/t/strange-fails-with-cronplus-and-exec-nodes/78881/17 "2023-06-03T13:35:11Z")

</div>

> [@cameo69](#):
>
> I just imported your flow

Thanks for testing.

> [@cameo69](#):
>
> within a docker container, you connect to the docker container, because localhost points to the docker container

That would be true if the container weren't started with the

> --network=host

option.

---

<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:** [2 August 2023 13:35 UTC](https://discourse.nodered.org/t/strange-fails-with-cronplus-and-exec-nodes/78881/18 "2023-08-02T13:35:23Z")

</div>

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