in a file in the shell_commands folder is a yaml called shell_command_wol.yaml containing:
shutdown_john: "./scripts/shutdown.sh -a 192.168.0.23 -b <myname> -c <my_password>"
Ive tried the above with single quotes and no quotes and taking the entry in the configuration.yaml and pointing directly to the shell_command_wol.yaml but it still doesn’t find it.
Thanks Phil, much appreciated that got the shell command showing in my services. I triggered it and no error on screen but got a return code 127 NoneType: None in the logs. Any idea what that is about? Comes up as an Error running command. Not sure if I need to full path the path to shutdown.sh or not. I have a scripts folder at the same level as my shell_commands folder but maybe that’s not what that error is saying.
Edit: Full path didn’t help. Tried /usr/share/hassio/homeassistant/scripts/shutdown.sh and no joy
Nope, same deal. Not sure if /config is a valid path for my instance but maybe it’s virtual. Oddly if I put in a totally bogus path I still get the same thing so at that point it’s not even running the script. I did /config/scriptss/shutdown.sh with two s in scripts.
Also if I run the script manually on the Linux box as the homeassistant user it reboots the PC.
For hassio I’m led to understand that /config is the path to the folder that contains configuration.yaml. So if shutdown.sh is in a subdirectory of that named scripts, then it should be like I said, /config/scripts/shutdown.sh. Why would you make it scriptss???
Because I am testing. So if the “right” path is giving an error, what would the wrong path give? No one say’s it’s a path issue may be something in the shell script. So by making sure the path is wrong and the error is the same, shows it’s not my code. Or not yet since it doesn’t even look like it’s getting to it.
" Value 127 is returned by your shell /bin/bash when any given command within your bash script or on bash command line is not found in any of the paths defined by PATH system environment variable."
Yep. I have been digging a bit and seeing some people that say you need to ssh in to run this or something and need some kind of certs or something. Trying to get more details.
SSH was the answer. Took some work to figure out but had to generate some certs and the like.
That said, I am finding there are certain circumstances where WOL will work and others where I need to run a script to turn something back on. Like if it’s a virtual it’s not listening so need to trigger it by script. I would like one nice interface though that is for all computers. Some would be turned on by WOL, others by scripts. i assume I would probably either need to abandon the WOL platform or split things up where the direct computers use WOL and the virtuals maybe do something where I have to ping them to see if they are on and if you flip a switch SSH into my Windows machine running VMware workstation and run a batch to turn on the selected virtual?
Thanks, I’ll give it a shot, but my destination backup server account doesn’t have a password. So when I say it works from the commandline, I don’t have to input a password. Do I still need keys?
SSH = Secure SHell Protocal. I believe regardless if the server has a password, the application(ssh) requires authentication. HA also runs in a container separate from ssh so the key is needed for HA to run a command in another container.