This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Error not sending file via ftp service!
#5
Thank admin !
I use script:
------------------
---------------
--Take a backup and ftp to NAS
-- name of backup file
src = 'LM_nha_mau_HN-' .. 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 = '<fpt_user>' .. 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 = socket.ftp.put{
host = "100.100.100.99",
user = "fpt_user",
password = "gammajsc",
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*')
-----------------
Am I something wrong? Please help me
Reply


Messages In This Thread
RE: Error not sending file via ftp service! - by phongvucba - 26.02.2018, 16:03

Forum Jump: