Host pi
HostName 10.0.0.156
User pi
IdentityFile ~/.ssh/id_ed25519
IdentitiesOnly yes
UNTESTED
here is a command to find files older then 2 days and transfer them find /path/backups/ -type f -mtime +2 -exec rsync -vPhd -e "ssh -p 22" {} --delete --ignore-existing pi:/remote/path/server-backups/ \;
then in remote path you can use “pi” instead of user@host
Here is a UNTESTED shell script that could be run on cron daily or whatever
#!/bin/bash
CURRENT=$(df / | grep / | awk '{ print $5}' | sed 's/%//g')
THRESHOLD=90
if [ "$CURRENT" -gt "$THRESHOLD" ] ; then
find /path/backups/ -type f -mtime +2 -exec rsync -vPhd -e "ssh -p 22" {} --delete --ignore-existing pi:/remote/path/server-backups/ \;
fi
Thanks. For development of Mycodo Modules, I like to use as few commands as necessary, especially when executing shell commands, so I’ll likely drop to using only rsync. Also, for instructing users to perform tasks external to Mycodo (i.e. Mycodo doesn’t perform them for the user), they need to be as simple as possible, which is why I linked in discord to:
If the user wants to do something more complex, that’s their decision, but what’s in the docs (or in this case, the info displayed to the user when they expand the Input options) should be as simple as possible.
I’ll see what basic Function I can come up with and post for anyone to test.
It’s all working now and committed to the master branch. You will need to have the latest code from the master branch for changes that will allow it to even run. I have it backing up the cameras directory and Mycodo settings, and an Action that allows you to induce a settings backup (since a backup only occurs if the Mycodo or database version numbers change). Give it a try and let’s develop it a bit more.