Code: Select all
2020-02-04 12:01:24 martedì 4 febbraio 2020 - 12:01 : DB backup finished succesfully on raspberrypi
2020-02-04 11:58:31 martedì 4 febbraio 2020 - 11:58 : DB backup Starting .. on raspberrypi
2020-02-04 04:01:51 martedì 4 febbraio 2020 - 04:01 : DB backup lftp failed on raspberrypi
2020-02-04 04:01:01 martedì 4 febbraio 2020 - 04:01 : DB backup Starting .. on raspberrypitrigger an os comand.
this script has two purposes:
1) lunch an os command if i press dummy switch named "ftpbackup" and this works
2) every day at 8:50 check if the text inside alert device named "alert_ftpbackup" contain sentence like "DB backup finished succesfully on raspberrypi"
if yes lounch a backup, otherwise do nothing.
how i can verify if inside thext of device there are some king of words?
thanks
Code: Select all
return
{
on =
{
devices = { 'ftpbackup' },
timer = { 'everyday at 8:50' },
},
logging = {
level = domoticz.LOG_DEBUG,
marker = "FTP BACKUP"
},
execute = function(dz, item)
local backupAlert = dz.devices('alert_ftpbackup')
dz.log('extract text from device =============> '..backupAlert.text , dz.LOG_DEBUG)
if backupAlert.text == "DB backup finished succesfully on raspberrypi" then
os.execute ('sudo /var/www/MyScripts/ftpbackup.sh &')
dz.log('NOW INSIDE IF, YEAH!!!!!!!!!!!!!!!!!!!', dz.LOG_DEBUG)
end
if item.active then
os.execute ('sudo /var/www/MyScripts/ftpbackup.sh &')
end
end
}