Yesterday i was logged in to my Wiser/LM
i saw there all my backups still on my Wiser.
The script is working, i got my backup on my FTP server, but the backups are also still on my Wiser, it looks like, they don't delete the backup files.
my question is, is there something wrong with my clean up line?
i saw there all my backups still on my Wiser.
The script is working, i got my backup on my FTP server, but the backups are also still on my Wiser, it looks like, they don't delete the backup files.
my question is, is there something wrong with my clean up line?
Code:
--source: https://forum.logicmachine.net/showthread.php?tid=396&pid=2488#pid2488
--Take a backup and ftp to NAS
-- name of backup file
src = 'Project-Wiser_for_KNX-' .. 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 = '/Backup en Exports/Wiser/200 Meterkast/Backup/' .. src --for backup Wiser Primair 200
--target = '/Backup en Exports/Wiser (201) sec/Backup sec/' .. src --fro backup Wiser Secundair 201
-- 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 = "192.168.3.58",
user = "FTP-User",
password = "my_password",
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*')