Command_line

I’m running the following version of hassio from a vmbox

Home Assistant 2022.12.8
Supervisor 2022.12.1
Operating System 9.4
Frontend 20221213.1 - latest

I’m trying to run the command net rpc and I get an error 127 despite the fact I can run the command from the terminal window without any problem. I’m at a loss as to how to get this command to run when trigged from hassio.

My Yaml

switch:
  - platform: command_line
    switches:
      plex_server:
        command_off: net rpc -S 192.168.1.18 -Uxxxx%xxxxx shutdown -t 1 -f

I’ve even tried specifing the full path to net /usr/bin/net to noavail.

Shouldn’t that be in qoutes?
'command_off: net rpc -S 192.168.1.18 -Uxxxx%xxxxx shutdown -t 1 -f'

Not sure if that matters but you can at least try it.

Thanks for reply I should have mentioned I’ve tried with no quotes, single and double all with the same result.

I have a horrible feeling unless the command is included in busybox you’re not allowed to run it. I’ve tried moving net to the /bin folder, I tried moving the command to a shell script with /bin/bash as the shebang line, if you execute bash manually /usr/bin ends up in your path. I’ve tried adding /usr/bin to the path in the shell script all to noavail. I can’t believe it’s this hard to execute a command from within hassio. Do I need to recompile busybox?

I think it is a result of the different environments, ie the difference between the homeassistant container and the SSH container.

Yes you’re correct after I read the documentation fully sadly I can not do what I want I use the home assistant OS so it’s all running in it’s own container with no access to the required command. That little snippet could do with moving towards the top of the command line page so you don’t miss it. :wink:

Dunno if this helps, but I thought it might :slight_smile:

What I ended up using was this which works fine on my old Win 7 plex server IOT Link | Service to provide Internet Of Things (IOT) integration with Windows using MQTT. I can now just publish the shutdown topic to mqtt the PC shuts down.

Thanks for the ideas.