In the release notes I saw that they have added the ability to create Hassio snapshots through a service call:
Pascal has made it easier to create and restore snapshots for Hass.io by calling the new services. This way it will be easy to automate the creation of a snapshot at night. The updater has also been fixed and will now report on new versions of Hass.io that are available.
Has anyone seen any documentation around this feature? I was digging through the code and looking at the hassio component and see mention of a snapshot ability, but no documentation around how to use it. And the documentation link in the code does not work (Home Assistant Supervisor - Home Assistant).
Not a scp solution, but the easiest solution for me was to create a scheduled task on my DC to call a simple batch script after the snapshot was made to copy the contents of the \\HASSIO\backups directory to another PC that I use essentially as a NAS device and then delete the contents of the backup directory.
Doing this from Windows means Samba has to be installed and configured.
The batch script looks like this:
@ECHO off
SET Source=\\HASSIO\backup
SET Target=\\SERVERNAME\share\Hass.IO_Backups
SET Date=_%date:~-4,4%%date:~-7,2%%date:~-10,2%
IF NOT EXIST "%Target%" MD "%Target%"
FOR %%i IN ("%Source%\*.*") DO ^
COPY "%%i" "%Target%\%%~Ni%Date%%%~Xi"
IF EXIST "%Target%\%%~Ni%Date%%%~Xi" DO (
DEL "%Source%\*.*" /Q
)
Keep in mind my snapshots aren’t appended with the date like NotoriousBDG’s are. You’ll probably want to drop that from either the automation or batch script.
I’m working on an add-on that allows you to upload your /backup directory to your Dropbox.
Currently, you have to manually start the add-on to trigger the upload to your Dropbox, but I’d eventually like to make this a more automated process (as I discuss at the bottom of the README). I think this combined with the snapshots automation here would be really nice.
I’ve updated the add-on to v1.0.0. The uploading is triggered via a service call, so it can be automated just as any other home assistant service (like making snapshots)
Coincidentally I just answered a question about google drive in the main project thread. I think it’d make more sense to do it in a separate add-on, but since you’re interested I’ll look into making one.
If I ssh into hassio and run scp /backup/* wdmycloudmirror:~ then it works just fine using ssh keys, but if I call the service trough hassio then I get an error code 1. How come?
Is /backup/ not accessible from shell_command? One has to create a docker? I have no experience with that though - dang. Probably time well spent anyways.
When you use the shell_command component, you’re calling that command from Home Assistant, which runs on Hass.io but is not the same and is designed to have restricted access. As you say, implementing your shell command as an add-on would be the way to go if you want to trigger it or automate it from the front end.
I’ve now created an addon that creates a snapshot, copies it to a remote server location using SCP and then removes the local snapshot again. Then I have a simple automation script that starts the addon every day on timed schedule.
At the moment I’ve just made it local but let me know if anybody wants be to distribute on Github.