I’m using this line:
Code: Select all
os.execute ('curl -s "https://www.example.com/gateway/?user=binbo&pass=123
How can I catch when the curl fails to allow my other parts of the script to continue running?
Thanks for the help
Moderator: leecollings
Code: Select all
os.execute ('curl -s "https://www.example.com/gateway/?user=binbo&pass=123
Code: Select all
local diskused='diskused'
return {
on = {
timer = {
'every minute'
},
shellCommandResponses =
{
diskused,
},
},
logging = {
level = domoticz.LOG_INFO,
marker = 'template',
},
execute = function(domoticz, item)
if item.isTimer then
domoticz.log('Timer event was triggered by ' .. item.trigger, domoticz.LOG_INFO)
domoticz.executeShellCommand({
command = 'df -h /media/usbdisk | grep media | awk \'{print $5}\' | awk -F% \'{print $1}\'',
callback = diskused,
timeout = 5,
})
else
domoticz.log('Disk used ' .. item.data, domoticz.LOG_INFO)
domoticz.log('Disk used % ' .. tonumber(item.data), domoticz.LOG_INFO)
if tonumber(item.data)<10 then
domoticz.log('Enough space left. Disk used ' .. item.data, domoticz.LOG_INFO)
else
domoticz.log('Watch your disk space. Disk used ' .. item.data, domoticz.LOG_INFO)
end
end
end
}
Code: Select all
os.execute('curl -s "https://www.example.com/gateway/?user=binbo&pass=123" &')
Users browsing this forum: No registered users and 1 guest