Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95919

Where do shell commands go?

$
0
0

@jriker1 wrote:

I am struggling with two items:

  1. I am creating a shell script, shutdown.sh. Where should this physically reside and how do I call it? I’m thinking to put it in the scripts folder but do you use the full path or just do scripts/shutdown.sh?

  2. Are you able to pass parameters to this script? Using wake_on_lan with the turn_off call. This script takes 3 commands now, and hoping 4 eventually. So when I call the script it would be like:

./shutdown.sh -a 192.168.0.23 -b -c

Then the script will take these variables and call a shutdown script, passing the right parameters and stopping the computer. So take 192.168.0.23, in my switch file that is a parameter:

- platform: wake_on_lan
  name: "Mediacenter"
  mac: "##:##:##:##:##"
  host: 192.168.0.23

But can I pass this to my script?

So if you have something like the below in my switches yaml file:

  turn_off:
    service: shell_command.wol_off

and then call my script thru my shell commands yaml like

wol_off: shutdown.sh -a $host -b jriker -c <password>

Can thee values for -a , -b , and -c be passed in the service call above somehow? The $host is just made up, not sure if it would work.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 95919

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>