[fsync] check whether sensor exists and has been enabled when symlinking

This commit is contained in:
Bart Van Der Meerssche 2011-03-06 00:25:14 +01:00
parent 5681ec612f
commit 7b5b64abf8
1 changed files with 7 additions and 4 deletions

View File

@ -238,10 +238,13 @@ end
-- generate new symlinks
for i = 1, MAX_SENSORS do
local sensor_id = flukso[tostring(i)].id
if sensor_id then
nixio.fs.symlink(CGI_SCRIPT, API_PATH .. sensor_id)
print(string.format('ln -s %s %s%s .. ok', CGI_SCRIPT, API_PATH, sensor_id))
if flukso[tostring(i)] ~= nil and flukso[tostring(i)].enable == '1' then
local sensor_id = flukso[tostring(i)].id
if sensor_id then
nixio.fs.symlink(CGI_SCRIPT, API_PATH .. sensor_id)
print(string.format('ln -s %s %s%s .. ok', CGI_SCRIPT, API_PATH, sensor_id))
end
end
end