So I have to backup plans in place now thanks to the great info on here and @turboc and others.
rsync
I use rsync over ssh to back up the configuration directory to another Pi I have on the network that does duty as a file server.
dd
I set up a command to run dd over ssh to make an image of the SD card and put that image on the file server Pi mentioned above.
What I am wondering is whether or not there is any benefit or use in automating this in HA? Or am I better off just using crontab?
I would like to run the rsync from within HA so I can synchronize those files as needed but I am not sure how to do this in HA. An input slider doesn’t seem like the thing you would use, and an input select might be better, but I am not sure how to set such a thing up.
Anyone have examples of how they are using and automating shell scripts from within HA?
# Developed 30Nov2016
# Chip Cox
# designed to backup hass directory from a Raspberry Pi running Home Assistant in a virtual environment
# Set Directory and filename variables
# This is the mount point for my usb drive.
# your destination directory will probably be different
filedir=/mnt/usbdrive/
# I'm starting this backup in the home directory for the hass user.
srcdir="~"
#current date format DDMONYYYY
current_time=$(date "+%d%b%y")
# build output filename
filename=$filedir"hass"$current_time"backup.tar"
# display backup information.
echo $filename > ~/backup.log
echo "Current Time : $current_time" >> ~/backup.log
# Create the tar file given with verbose output and put the contents of srcdir in it.
# excluding .cache directory
#
cmd="tar -cvf $filename --exclude .cache $srcdir"
echo $cmd >> ~/backup.log
# DoIt
eval $cmd >> ~/backup.log
#now that you have the tar file, zip it up to save space.
gzip $filename >> ~/backup.log
Just realized I had left this line out that’s in my configuration.yaml
@turboc, Was that in the documentation somewhere? If so, I am sorry, I looked in the Components section and saw shell script it didn’t lend itself well to helping me out.
LOL, yea, some of the documentation is that way. I’ve had lots of help from the people on the board too, just like you. This is just what I am using for my nightly backups