Include backup date and hostname in backup archive name
authorSteven Barth <steven@midlink.org>
Sun, 9 Nov 2008 20:09:31 +0000 (20:09 +0000)
committerSteven Barth <steven@midlink.org>
Sun, 9 Nov 2008 20:09:31 +0000 (20:09 +0000)
modules/admin-full/luasrc/controller/admin/system.lua
modules/admin-mini/luasrc/controller/mini/system.lua

index 1afdfc55ef2928c1c686b1937223ee22aecf5ac9..b6de148843c747084d5c2c915e06fe9534f311ad 100644 (file)
@@ -144,7 +144,8 @@ function action_backup()
        elseif backup then
                luci.util.perror(backup_cmd:format(_keep_pattern()))
                local backup_fpi = io.popen(backup_cmd:format(_keep_pattern()), "r")
-               luci.http.header('Content-Disposition', 'attachment; filename="backup.tar.gz"')
+               luci.http.header('Content-Disposition', 'attachment; filename="backup-%s-%s.tar.gz"' % {
+                       luci.sys.hostname(), os.date("%Y-%m-%d")})
                luci.http.prepare_content("application/x-targz")
                luci.ltn12.pump.all(luci.ltn12.source.file(backup_fpi), luci.http.write)
        elseif reset then
index 936d2634acce58e95a3945d487f314ac712bbeba..1a26280725558c72e7864f3e048b6c487c781598 100644 (file)
@@ -57,7 +57,8 @@ function action_backup()
        elseif backup then
                luci.util.perror(backup_cmd:format(_keep_pattern()))
                local backup_fpi = io.popen(backup_cmd:format(_keep_pattern()), "r")
-               luci.http.header('Content-Disposition', 'attachment; filename="backup.tar.gz"')
+               luci.http.header('Content-Disposition', 'attachment; filename="backup-%s-%s.tar.gz"' % {
+                       luci.sys.hostname(), os.date("%Y-%m-%d")})
                luci.http.prepare_content("application/x-targz")
                luci.ltn12.pump.all(luci.ltn12.source.file(backup_fpi), luci.http.write)
        elseif reset then