07.05.2018, 07:49
Hi all,
I want to read a json file on my HL (SV: 2.1.1) FTP server via a scheduled script every 5 minutes. But if the script is started by the cron job it gets nil for this file. If I execute the script manually or as resident script it works without a problem. Then I added a write command to the scheduled script for testing purposes and the writing worked / the script is executed. So my question is why the script can read the json file if I start it manually but not if started by the cron job?
I want to read a json file on my HL (SV: 2.1.1) FTP server via a scheduled script every 5 minutes. But if the script is started by the cron job it gets nil for this file. If I execute the script manually or as resident script it works without a problem. Then I added a write command to the scheduled script for testing purposes and the writing worked / the script is executed. So my question is why the script can read the json file if I start it manually but not if started by the cron job?
Code:
grp.write('1/1/7', 1)
path = 'home/ftp/Daten/'
require('json')
Verbrauch_datei = 'Verbrauch.json'
Verbrauch_data = io.readfile(path..Verbrauch_datei)
log(Verbrauch_data)
if Verbrauch_data ~= nil then
Verbrauch_data_lua = json.decode(Verbrauch_data)
else
Verbrauch_data_lua = {}
end