Automate Vera Backup Process

I’ve been playing with ways to automate the scheduled backup of Vera. I’d like to be able to get a backup of Vera periodically and safe-store it on my NAS or the Cloud (DropBox, Google Drive, etc.)

If you send the this HTTP request from a web browser:

http://[Vera IP]/cgi-bin/cmh/backup.sh?external=1

to Vera the result will be the backup data file sent back to the browser. You can automate the HTTP Request process in Windows scheduler by creating a VB Script with the Request in it and scheduling that and it works. But it doesn’t know anything about what to do with the response file so it essentially just goes in the bit-bucket.

Has anyone worked out a scheduled backup of Vera?

I have one that runs via cron on my Mac, and uses curl, but not one for Windows. You could probably do the same in either Windows Cygwin, or by running the curl command on Vera itself (to local USB) and then have Vera copy it to the NAS (via SCP or similar, depending upon hat the NAS supports)

The Mac variant looks like the following but could be adapted to cygw

#!/bin/sh

export TODAY=`date "+%Y-%m-%d"`
/usr/bin/curl --silent --output ~/Scripts/vera/backup.mios2-Vera3Pro-300nnnnn-${TODAY} http://192.168.1.5/cgi-bin/cmh/backup.sh

if [ $? -gt 0 ]; then
    terminal-notifier -message "Vera Backup Schedule failed (curl)" -title "Backup Download failure" > /dev/null
    exit 1
fi

This might be of interest to you,

http://forum.micasaverde.com/index.php/topic,23957.msg164476.html#msg164476

[quote=“parkerc, post:4, topic:181283”]This might be of interest to you,

http://forum.micasaverde.com/index.php/topic,23957.msg164476.html#msg164476[/quote]

Thanks. Am I correct that this assumes an external file system support on Vera? What is the scheduling control for this bit of code?

Use WGet for Windows or Curl for Windows

Ah, the famous Swiss Army Knife, fo software WGet. I’ve got it but for some reason it never occurred to me to use to for this. Thanks for reminding me.

John

I’ve been playing with WGET but I can’t figure out how to get it to save the file using the filename provided by Vera which contains the vera name, date, etc. I keep getting the filename saved as “backup.sh” from the input URL. If I input the URL manually in a browser I get the backup name correct but not with WGET, it insists on taking the name from the input URL and none of the options I’ve tried make any difference.

WGet saves as you describe by default. You can specify an explicit filename with the -O or --output-document= option. The option you really want is --content-disposition, but I don’t know if the Windows version(being old) has that option.

You’ll either need to use curl or rig up a convoluted batch file that injects your own date and time file name into a variable in the -O option of the WGet command line. The following is untested, but should work.

wget -O %%date:~-4,4%%date:~-7,2%%date:~0,2%%.Mios.backup http://YourVeraIP/cgi-bin/cmh/backup.sh

[quote=“Z-Waver, post:9, topic:181283”]WGet saves as you describe by default. You can specify an explicit filename with the -O or --output-document= option. The option you really want is --content-disposition, but I don’t know if the Windows version(being old) has that option.

You’ll either need to use curl or rig up a convoluted batch file that injects your own date and time file name into a variable in the -O option of the WGet command line. The following is untested, but should work.

wget -O %%date:~-4,4%%date:~-7,2%%date:~0,2%%.Mios.backup http://YourVeraIP/cgi-bin/cmh/backup.sh

That’s, I’ll give that a try.

[quote=“Z-Waver, post:9, topic:181283”]WGet saves as you describe by default. You can specify an explicit filename with the -O or --output-document= option. The option you really want is --content-disposition, but I don’t know if the Windows version(being old) has that option.

You’ll either need to use curl or rig up a convoluted batch file that injects your own date and time file name into a variable in the -O option of the WGet command line. The following is untested, but should work.

wget -O %%date:~-4,4%%date:~-7,2%%date:~0,2%%.Mios.backup http://YourVeraIP/cgi-bin/cmh/backup.sh

I tried --content-disposition and it is in fact implemented so can get the backups in the same filename format the regular ones

Thanks very very much
John

[quote=“Z-Waver, post:9, topic:181283”]WGet saves as you describe by default. You can specify an explicit filename with the -O or --output-document= option. The option you really want is --content-disposition, but I don’t know if the Windows version(being old) has that option.

You’ll either need to use curl or rig up a convoluted batch file that injects your own date and time file name into a variable in the -O option of the WGet command line. The following is untested, but should work.

wget -O %%date:~-4,4%%date:~-7,2%%date:~0,2%%.Mios.backup http://YourVeraIP/cgi-bin/cmh/backup.sh

wget -P vera_backup --content-disposition http://[Vera IP Address]/cgi-bin/cmh/backup.sh

Good news is this works. bad news is it produces a ZERO byte file for some reason

Back to the drawing board for me I guess :slight_smile:

It works for me, but I’m using Linux. Did you try curl, I’m not confident about how up-to-date the Windows version of Wget is.

I’m going to have to take a look at CURL I guess.
John