Help with my first shell command

So, I’m trying to get a shell command working so that I can create a backup on my HA directory to a USB stick for safe keeping.

Here is what I have so far:
In .homeassistant/scripts/backup.yaml

backup:
  alias: Backup HA Configuration Files
  sequence:
    - service: shell_command.backup_config

In .homeassistant/scripts/backup_config.sh

shell_command:
  backup_config: rsync -av /home/homeassistant/.homeassistant/* /mnt/usb/backup-$(date +"%Y%m%d%H%M")/ --exclude deps --exclude home-assistant_v2.db

and in .homeassistant/automation/backup.yaml

alias: Backup HA Configuration Files
trigger:
  platform: time
  hours: 1
  minutes: 1
  seconds: 0 
action:
  - service: shell_command.backup_config

The error message i receive on the dev-info page is:
2017-06-30 22:34:47 WARNING (MainThread) [homeassistant.core] Unable to find service shell_command/backup_config

The script is visible in the HA front end and looks like it does call the shell command or at least the backup.yaml file in the scripts directory when I click the ACTIVATE button.

Do I need to move the backup_config.sh to a different location?

Thanks in advance, I’m still kinda new to all this.

Bryan

In your shellcommand.yaml .....

backup_config: './home/homeassistant/.homeassistant/scripts/backup_config.sh'

you will need ....

# Shell Commands #
shell_command: !include shellcommand.yaml

in your configuration.yaml

That should get it working :slight_smile:

Wherever you have your shell command defined, it should just be a path to the shell script (backup_config.sh)

Got it! Thanks to both of you! I can’t tell you how much time this will save me in the future from not needing to rebuild when I corrupt my SD card!

Thank you so much!

Could anyone… please… make sure that somewhere there are pointers on the fact that it needs to have lower casing. Otherwise shell command entities do not work…