Fixed bug which led to empty ath9k crontab file

The crontab file was opened in write mode but in the case where no monitor is defined it would leave an empty file.
This commit is contained in:
Cyrus 2014-07-20 16:24:51 +02:00 committed by lcb01
parent b469347770
commit ef40aa28e8
1 changed files with 6 additions and 4 deletions

View File

@ -5,8 +5,10 @@ local uci = require 'luci.model.uci'
local c = uci.cursor()
local f = io.open('/lib/gluon/cron/ath9k-workaround','w')
if f and site.monitor ~= nil then
f:write('* * * * * /usr/sbin/ath9k-workaround | nc ' .. site.monitor)
f:close()
if site.monitor ~= nil then
local f = io.open('/lib/gluon/cron/ath9k-workaround','w')
if f ~= nil then
f:write('* * * * * /usr/sbin/ath9k-workaround | nc ' .. site.monitor)
f:close()
end
end