# Can't send command via exec

**URL:** <https://discourse.nodered.org/t/cant-send-command-via-exec/56255>\
**Category:** General\
**Created:** [7 January 2022 13:59 UTC](https://discourse.nodered.org/t/cant-send-command-via-exec/56255 "2022-01-07T13:59:55Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![strelniece](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/strelniece/32/53706_2.png) [@strelniece](https://discourse.nodered.org/u/strelniece)\
**Post date:** [7 January 2022 13:59 UTC](https://discourse.nodered.org/t/cant-send-command-via-exec/56255/1 "2022-01-07T13:59:55Z")

</div>

Hi,

Trying to turn the screensaver on/off via the exec-node, but doesn't work.

Running on debian 11,  
Command I try to use: cinnamon-screensaver-command with flags -d and -a

result:  
stdout: Can't connect to screensaver!  
stderr: Unable to init server: Could not connect: Connection refused  
Unable to init server: Kunde inte ansluta: Connection refused  
return code: {"code":0}

If i run with flag -h, I get all help, and -v gives me the version without problem.

If I run it from the terminal on the computer, executes as it should without errors.

if I run it from terminal on another computer it executes, but with same stderr

If I run it from my android with JuiceSSH, executes without problem, no error. the same when executed from android tasker using autotools SSH

So somehow it seems like the problem lies with NR

I have tried several configurations, like:

command: cinnamon-screensaver-command -a  
command: cinnamon-screensaver-command and append -a  
append with msg.payload etc, etc...

Running out of ideas here, so please help.

my setup:

Old laptop running Debian 11 and Supervised Home assistant (unsupported). Using the screen as an info-center, not easily accesible and would like to be able to turn the screen off when not home/night etc, and then back on when needed.

So the idea is that when HA trigger away, night etc, I will send a MQTT-message to the NR installation on the laptop. Yes, two NR needed, one for the HA, and one for the non HA part since HA doesn't communicate directly to the host, at least not that I have found out...

Thanks

---

<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:** [7 January 2022 15:17 UTC](https://discourse.nodered.org/t/cant-send-command-via-exec/56255/2 "2022-01-07T15:17:40Z")

</div>

Welcome to the forum @strelniece

Try adding `DISPLAY=:1 ` in front of the command.

---

<div class="post-metadata">

**Author:** ![strelniece](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/strelniece/32/53706_2.png) [@strelniece](https://discourse.nodered.org/u/strelniece)\
**Post date:** [7 January 2022 15:25 UTC](https://discourse.nodered.org/t/cant-send-command-via-exec/56255/3 "2022-01-07T15:25:26Z")

</div>

sorry, didn't work. this is what I wrote in the command-box:

DISPLAY=:1 cinnamon-screensaver-command -a

At least I assume I just write it as I do in the terminal.

---

<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:** [7 January 2022 19:01 UTC](https://discourse.nodered.org/t/cant-send-command-via-exec/56255/4 "2022-01-07T19:01:08Z")

</div>

Try DISPLAY=:0. If that doesn't work then I don't know.

---

<div class="post-metadata">

**Author:** ![strelniece](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/strelniece/32/53706_2.png) [@strelniece](https://discourse.nodered.org/u/strelniece)\
**Post date:** [7 January 2022 19:54 UTC](https://discourse.nodered.org/t/cant-send-command-via-exec/56255/5 "2022-01-07T19:54:54Z")

</div>

Sorry, same result ☹

---

<div class="post-metadata">

**Author:** ![strelniece](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/strelniece/32/53706_2.png) [@strelniece](https://discourse.nodered.org/u/strelniece)\
**Post date:** [12 January 2022 11:11 UTC](https://discourse.nodered.org/t/cant-send-command-via-exec/56255/6 "2022-01-12T11:11:50Z")

</div>

Not really a solution, but rather an alternative, used:  
xset -display :0.0 dpms force on/off  
instead and solved my problem.

---

<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:** [13 March 2022 11:12 UTC](https://discourse.nodered.org/t/cant-send-command-via-exec/56255/7 "2022-03-13T11:12:21Z")

</div>

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