rpitera
(Robert Pitera)
March 1, 2017, 7:05pm
21
shell_commands.yaml
#Front Cam
front_preset_1: '/home/hass/shell_scripts/f_preset1.sh'
front_preset_2: '/home/hass/shell_scripts/f_preset2.sh'
front_preset_3: '/home/hass/shell_scripts/f_preset3.sh'
ir_off: '/home/hass/shell_scripts/ir_off.sh'
#Rear Cam
rear_preset_1: '/home/hass/shell_scripts/r_preset1.sh'
rear_preset_2: '/home/hass/shell_scripts/r_preset2.sh'
rear_preset_3: '/home/hass/shell_scripts/r_preset3.sh'
rear_preset_4: '/home/hass/shell_scripts/r_preset4.sh'
cmcelroy09
(Chris McElroy)
March 1, 2017, 7:55pm
22
Iā'm having all kinds of trouble trying to run a gitupdate.sh shell command. So far everything I have tried has resulted in failure!
keithh666
(Keith Hull)
March 1, 2017, 10:13pm
23
Hmm same as mine except that Iāve tried with none like yours, bash and sudo bash at the front
BTW I looked at who owns the file ā¦
ls -l b*.sh
-rwxr-xr-x 1 homeassistant homeassistant 647 Feb 28 22:16 backup_config.sh
Hmm I had a thought does it matter who owns the directory Iām writing to?
rpitera
(Robert Pitera)
March 1, 2017, 10:26pm
24
I donāt think so. But hass owns my shell_script dir so youāre the same as me.
keithh666
(Keith Hull)
March 1, 2017, 11:14pm
25
I think the problem is the usb thumb drive Iām trying to copy to, itās that, that refuses permission to mv/cp the back.tgz file, however I donāt know how to solve that problem as itās a windows formatted drive with only root privileges.
Shell Scripts:
backup_config.sh
#!/bin/bash
BACKUP_FILE=/media/pi/HASSUSB/hass-config_$(date +"%Y%m%d_%H%M%S").zip
pushd /home/homeassistant/.homeassistant >/dev/null
zip -9 -q -r $BACKUP_FILE . -x"components/*" -x"deps/*" -x"home-assistant.db" -x"home-assistant_v2.db" -x"home-assistant.log"
popd >/dev/null
echo Backup complete: $BACKUP_FILE
Shell Commands:
backup_config: /home/homeassistant/.homeassistant/shell_scripts/backup_config.sh
Automation:
- alias: Backup config
hide_entity: True
trigger:
platform: time
after: '03:00:00'
action:
service: shell_command.backup_config
That works for me perfect writes a backup everday at 3 AM.
Make sure you :
sudo chown homeassistant:homeassistant /media/pi/HASSUSB
sudo chmod 777 /media/pi/
Let me know.
keithh666
(Keith Hull)
March 2, 2017, 12:06am
27
Finally it works It seems the shell command does not like the single quotes for .sh files, who knew! Many thanks for the help guys.
Myansia
(Myansia)
October 19, 2019, 12:44am
28
Hi,
what path do I use if I am using Home Assistant in Synology Docker?
Thanks.