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!
#6
Hi

Could it be that you configurered sftp?

If so try to use the adapted script below, but you also need a new FTP package which you can find here

please install updated package:
https://dl.openrb.com/lm-17/pkg/luasocke...21_mxs.ipk

Code:
require('socket.ftp') ------------------------- -- CONFIG ------------------------- FTP_TARGET_FOLDER =  '' FTP_TARGET_IP =  '' FTP_TARGET_LOGIN = '' FTP_TARGET_PW = '' ------------------------- -- FUNCTIONS ------------------------- -- backup the config and transfer it to the nas function backup()    log("System Backup: started")  --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 = FTP_TARGET_FOLDER .. 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 .. ' ./')     -- ftp to NAS  log("System Backup: transfering backup to NAS, host:" .. FTP_TARGET_IP .. ", target:" .. target)  res, err = socket.ftp.put({      host = FTP_TARGET_IP,      user = FTP_TARGET_LOGIN,      password = FTP_TARGET_PW,      secure = true,      datasecure = true,      type = "i",      argument = target,      source = ltn12.source.file(io.open(dst, "rb")) })       if (err) then    logMsg = "System Backup: failed with error:"    if (error) then      logMsg = logMsg .. err    else      logMsg = logMsg .. "nil"    end    if (res) then      logMsg = logMsg .. ", result:" .. res    else      logMsg = logMsg ..  ", result:nil"    end    log(logMsg)    alert("System Backup: failed, could not ftp to NAS, host:" .. FTP_TARGET_IP .. ", target:" .. target)    alert(logMsg)     end         -- 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*')  log("System Backup: completed") end
Reply


Messages In This Thread
RE: Error not sending file via ftp service! - by npinguin - 26.02.2018, 19:10

Forum Jump: