summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2008-10-29 01:12:49 +0000
committerJo-Philipp Wich <jow@openwrt.org>2008-10-29 01:12:49 +0000
commit9f19574ae0ae6d4881c83245d487b42251ff9528 (patch)
tree24fcf6e4d13957fbea7055fc6067f5db1690f9d5
parent9033d9b7bec0f7558c948d5196e768bf193d32f0 (diff)
* luci/app/statistics: fix syntax of collectd Exec plugin config
-rwxr-xr-xapplications/luci-statistics/root/usr/bin/stat-genconfig14
1 files changed, 10 insertions, 4 deletions
diff --git a/applications/luci-statistics/root/usr/bin/stat-genconfig b/applications/luci-statistics/root/usr/bin/stat-genconfig
index 7f0a05f5f..b62005ce1 100755
--- a/applications/luci-statistics/root/usr/bin/stat-genconfig
+++ b/applications/luci-statistics/root/usr/bin/stat-genconfig
@@ -94,11 +94,17 @@ function config_exec( c )
for key, type in pairs({ Exec="collectd_exec_input", NotificationExec="collectd_exec_notify" }) do
if sections[s][".type"] == type then
- cmd = sections[s].cmdline
- user = sections[s].cmduser or "nobody"
- group = sections[s].cmdgroup or "nogroup"
+ cmd = sections[s].cmdline
- str = str .. "\t" .. key .. " " .. user .. ":" .. group .. ' "' .. cmd .. "\"\n"
+ if cmd then
+ cmd = cmd:gsub("^%s+", ""):gsub("%s+$", "")
+ user = sections[s].cmduser or "nobody"
+ group = sections[s].cmdgroup
+
+ str = str .. "\t" .. key .. ' "' ..
+ user .. ( group and ":" .. group or "" ) .. '" "' ..
+ cmd:gsub('%s+', '" "') .. '"\n'
+ end
end
end
end