04.01.2022, 16:07
(08.11.2016, 22:32)baggins Wrote:(19.10.2016, 17:58)PassivPluss Wrote: I get the following log
*String send mail
*nil
*string revcd alert fatal error
Another way to run this script would be to upload to ftp server.
Hi PassivPluss,
This is an example (for LM4 firmware 20160714) of how to upload to a ftp server:
Code:--Take a backup and ftp to NAS
-- name of backup file
src = 'backup-' .. os.date('%Y.%m.%d_%H-%M') .. '.tar.gz'
-- where to put backup file on LM
dst = '/home/ftp/' .. src
-- where to put the backup on NAS
target = '<ftpdir>' .. src
-- prepare files for backup
os.execute('sh /lib/genohm-scada/web/general/backup.sh')
-- create archive
os.execute('cd /lib/genohm-scada/storage && tar -c -z -f ' .. dst .. ' ./')
-- load the ftp support
local ftp = require("socket.ftp")
local ltn12 = require("ltn12")
-- ftp to NAS
f, e = ftp.put{
host = "<ip_address_of_ftp_server>",
user = "<ftp_user>",
password = "<ftp_user_pwd>",
type = "i",
argument = target,
source = ltn12.source.file(io.open(dst, "rb"))
}
if (e) then
log (e)
log (f)
alert("Could not ftp: ", e, "\n")
end
log("ftp_backup")
-- cleanup
os.execute('cd /home/ftp && rm -rf backup_*')
os.execute('cd /lib/genohm-scada/storage && rm -rf user userlib.luas blockly.luas initscript.lua helpers.js genohm-scada.config filter*')
thanks i use it for a small month for now.
it did worked for me for 12 days without problems. after these days, i only get a backup of 0 Bytes.
all is working again, i think there where to big pictures and my export was 25MB.
But after this i didn't saw there is an issue.
My question, is it possible to get an error when the backup is just 0 bytes or below 100kb?