Backup your Backups


I have CIFS enabled on my Vera and my NAS mapped to it.

I was wondering if anyone was backing up their backups , and if so if they could share the lua code they are using to do it.

Also are there any other files on Vera that should be backed up too?

I just posted an answer about this at:,23950.msg164045.html#msg164045

Thanks @RTS

Now I know the request to create a new back up file → http://your.local.vera.ip.address/cgi-bin/cmh/

I’ve reworked the following code based on bits I’ve found online

local backup ="/cgi-bin/cmh/", "r") local output_filename = "/nas/vera_backup_" .."%Y%m%d-%H%M%S") ..".sh" local output =, "w") output:write(backup:read("*all")) output:close() backup:close()

I’ve not tested it yet, as I read this Programming in Lua : 21.2 and wanted to ask if I should use (b) rather than (r) if .sh is a binary file?


When running the above code, I receive the following error.

Please could someone help me troubleshoot it…

01 08/18/14 8:52:44.704 LuaInterface::StartEngine failed run: 0 [string “local backup =”/cgi-bin/cmh/backup…“]:4: attempt to index local ‘backup’ (a nil value) <0x2fbc4680>
01 08/18/14 8:52:44.704 JobHandler_LuaUPnP::RunLua failed: local backup =”/cgi-bin/cmh/", “r”)


I can see the file in /cgi-bin/cmd/ so not sure why it failed?
I think it’s telling me line 4: failed which is the write part…
Does it think the is empty or maybe it can’t create the destination file on the NAS ?

Please could someone help me troubleshoot it..

I thought I already did - back in March.



Wow! - Your memory is way better than mine ! Have you got yourself a cape yet ? :slight_smile:
Thanks you so much for jogging mine.

I’ve had to rebuild a new Vera so I lost a number of things and I’m now trying to put all the pieces back

[code]luup.call_timer(“dailybackup”, 2 , “00:09:00” ,“1,2,3,4,5,6,7”, “”)

function clrTaskMsg(handle)

function dailybackup ()
local handle = luup.task(“Loading…”,1,“AutoBackup”,-1)
local error, result = luup.inet.wget(“” ,30)
if error ~= 0 then
luup.task(“Error loading backup!”,1,“AutoBackup”,handle)
return false
local outfile = “/nas/vera_backup_” …“%Y%m%d-%H%M%S”)
local f,err =,“w”)
if not f then
return false
luup.task(“Writing file…”,1,“AutoBackup”,handle)
return true

Look correct to you?

Look correct to you?

That should work. As it is being run automatically, you may want to change the way it reports progress. There isn’t too much point in showing Task messages if you are not there to see them. On the other hand, you probably want to know if there was an error.

If you use SysLog, you could write the messages there. If not, then you could use luup.log(…) statements. You may want to retain the Task message for a failure but don’t clear it. That way you would be alerted to a problem.

Thanks again Rex

I will look into changing the task messages to Prowl notification code, that way I will be told the result via a push notification to my phone - and it’ll be stored within the Prowl app too to refer back to.

Re SysLogging - do you have any advice on a syslog set up ? I’ve seen it mentioned a few times on the forum, but not sure of the the product / set up people should use with Vera?

Any recommendations ?

I log to my Synology NAS. It has a reasonable interface for viewing logs and automatic archiving.

I have EventWatcher log all watched variables to SysLog - just by setting the variable Syslog to :514 - a fine piece of work by @akbooer.

You can send Syslog events from scenes using - Writing to Syslog by @akbooer

Is anyone aware of a command to issue that would cause the ZWave network to be backed up as well as the system?

EDIT: Found it and wrote a shell script to backup Zwave and system on an a schedule. Details here: [url=,30188.msg214990.html#msg214990],30188.msg214990.html#msg214990[/url]