summaryrefslogtreecommitdiffstats
path: root/logfiles-model.lua
diff options
context:
space:
mode:
Diffstat (limited to 'logfiles-model.lua')
-rw-r--r--logfiles-model.lua33
1 files changed, 22 insertions, 11 deletions
diff --git a/logfiles-model.lua b/logfiles-model.lua
index 2473a9f..6964c40 100644
--- a/logfiles-model.lua
+++ b/logfiles-model.lua
@@ -2,32 +2,43 @@ module (..., package.seeall)
-- no initializer in model - use controller.init for that
+local function is_file_in_use( file )
+-- local files_opened = io.popen("ls -l $( find /proc/[0-9]*/fd) | egrep 'tmp\|var' - | sed 's/ \+/ /g' | sort")
+ opens=" ls -l $( find /proc/[0-9]*/fd 2>/dev/null) 2>/dev/null | \
+ egrep 'tmp\|var' - | sed 's/ \+/ /g' | \
+ cut -f 12"
+ opens="ls -l `find /proc/[0-9]*/fd 2>&1` 2>&1 | egrep 'tmp|var'"
+--ls -l `find /proc/[0-9]*/fd 2>/dev/null` 2>/dev/null | egrep '\-\>' - | sed 's/ \+/ /g' | \
+-- cut -f 12"
+-- cut -f11 -d' ' | sort |uniq "
+ local files_opened = io.popen(opens)
+
+ local f = files_opened:read("*a") or "unknown"
+ table.insert ( listed_files , cfe{date="?", name=f, size="?"} )
+
+end
+
local function list_files ( path )
local listed_files = {}
local open_files = {}
split = require("split")
local files = io.popen("find " .. path .. " -type f | sort")
+ table.insert ( listed_files , cfe{delete="Delete", save="Save", view="View", size="Size", lastmod="Last Modified", name="File", header="yes"} )
+
if ( files ) then
local f = files:read("*a") or "unknown"
for k,v in pairs(split("%s", f)) do
if v ~= "" then
- table.insert ( listed_files , cfe{date="?", name=v, size="?"} )
+ table.insert ( listed_files , cfe{delete="", save="", view="", size="", lastmod="", name=v, type=""} )
+-- table.insert ( listed_files , cfe{date="?", name=v, size="?"} )
end
end
files:close()
end
- table.insert ( listed_files , cfe{date="---", name="--- Now follows list with open files to compare agains logfile-list ---", size="---"} )
+-- table.insert ( listed_files , cfe{date="---", name="--- Now follows list with open files to compare agains logfile-list ---", size="---"} )
+-- table.insert ( listed_files , cfe{delete="Delete", save="Save", view="View", size="Size", lastmod="Last Modified", name="File", type="header"} )
--- local files_opened = io.popen("ls -l $( find /proc/[0-9]*/fd) | egrep 'tmp\|var' - | sed 's/ \+/ /g' | sort")
- opens=" ls -l $( find /proc/[0-9]*/fd 2>/dev/null) 2>/dev/null | \
- egrep 'tmp\|var' - | sed 's/ \+/ /g' | \
- cut -f 12"
--- cut -f11 -d' ' | sort |uniq "
- local files_opened = io.popen(opens)
-
- local f = files_opened:read("*a") or "unknown"
- table.insert ( listed_files , cfe{date="?", name=f, size="?"} )
return listed_files
end