I would like to point out that the script is used in many web servers, both Schneider and LM, and has always worked and still works every day.
when I try to upload the backup to ftp, the upload happens, but the backup has size 0 and if I try to open it it gives me an error. Furthermore, it is logged in the error log
os.remove call blocked. What is going on?
when I try to upload the backup to ftp, the upload happens, but the backup has size 0 and if I try to open it it gives me an error. Furthermore, it is logged in the error log
os.remove call blocked. What is going on?
Code:
require('socket.ftp')
-- Get hostname
hostname = io.readfile('/proc/sys/kernel/hostname'):trim()
-- ftp file
ftpfile = string.format('ftp://user:pass@ip/backup/' .. os.date('%Y.%m.%w') .. '-' .. hostname .. '.tar.gz;type=i')
--Create attachment
src = 'backup-' .. os.date('%Y.%m.%d') .. '.tar.gz'
dst = '/home/ftp/' .. src
-- prepare files for backup
os.execute('sh /lib/genohm-scada/web/general/backup.sh')
-- create cleanup archive
os.execute('cd /lib/genohm-scada/storage && tar -c -z -f ' .. dst .. ' ./')
-- upload to ftp
result, err = socket.ftp.put(ftpfile, io.readfile(dst))
-- error while uploading
if err then
log('FTP upload error: %s', tostring(err))
else
log('file uploaded to external ftp')
end
--Delete created backup file from tmp folder inside HL
os.execute('cd /lib/genohm-scada/storage && rm -rf user userlib.luas blockly.luas initscript.lua helpers.js genohm-scada.config filter*')
--Delete file from HL ftp
os.remove(dst)