I have seen this question asked a few times with no answer.
I am using the hassio.backup_full service daily to make a backup. I am running the Home Assistant OS on Raspberry Pi and running an rsync over ssh command to copy my backups to my Mac. (The command is initiated through my Mac’s crontab).
I only want to keep backups for the last 7 days on my Raspberry Pi. So I want to run this command nightly in Home Assistant OS:
But that command fails because it cannot find /backup.
The documentation says that shell commands run in the “homeassistant” docker context, so I ran the following command to find out what my directory structure looks like:
docker exec -it homeassistant bash
and sure enough /backup is not there.
There might be a way to mount the /backup directory somehow, but I can’t figure out how to do this.
Thanks @apreick . I’m actually using Home Assistant OS (I don’t build anything, I just installed an image on my Raspberry Pi). But I believe that as part of the normal operation of Home Assistant OS, it uses the “homeassistant container context” (see snapshot of Shell Command documentation). I assumed they are referring to a docker context, but maybe it’s something else. It’s a bit nebulous.
No. The default location of the backup directory in Home Assistant OS is /backup.
➜ / ls /
addon_configs data lib proc ssl
addons dev lib64 root sys
backup etc media run tmp
bin home mnt sbin usr
command homeassistant opt share var
config init package srv
➜ /
Yup. I’m happy to move my backup directory somewhere else (in /share ?) but that would create a recursion since /share is apparently included in the backup. Ugh… there HAS to be a proper way to do this.
There are a few FRs to allow the backup service to do it itself or at least expose a service call to do it. (Service to remove backup).
Removing the leading slash didn’t work? The only other thing I can think of would be to SAMBA share the /backup directory and use another system to do it perhaps. I don’t know as I don’t use HAOS (I run Container).
Yes, I could use Samba… Maintaining Samba for me is more work than periodically (every 6 months?) running the purge command manually. I just sucks that the computer can’t do that for me. So simple
When in doubt make a bash script and run THAT in your command line instead of the command. If it works in shell and works in bash then your solution is at hand. That way you don’t have to navigate any tricky syntax issues in YAML and you can test easily until it’s dialed in.