I'm developing a script which monitors a service for failure and launches another a different action depending on if failure is present or not.
I require a python script to monitor the output from a python program "monitor-services" and parsing the output search for an occurance of the word "failure". If present, the script should return with a true value, and run for a maxiumum of 30 seconds returning false if no occurance of "failure" occurs.
Sample output returned from "monitor-services":
{Device} [/device/xxx] Networks = dbus.Array([dbus.ObjectPath('/device/xxx/xxx'), dbus.ObjectPath('/device/00242b2e41b6/hidden')], signature=dbus.Signature('o'), variant_level=1) {Service} [/profile/default/wifi_xxx_managed_wep] State = association {Profile} [/profile/default] Services = dbus.Array([dbus.ObjectPath('/profile/default/wifi_xxx_managed_wep'), dbus.ObjectPath('/profile/default/wifi_xxx_managed_rsn')], signature=dbus.Signature('o'), variant_level=1) {Manager} [/] Services = dbus.Array([dbus.ObjectPath('/profile/default/wifi_xxx_managed_wep'), dbus.ObjectPath('/profile/default/wifi_xxx_managed_rsn')], signature=dbus.Signature('o'), variant_level=1) {Service} [/profile/default/wifi_xxx_managed_wep] **failure** {Service} [/profile/default/wifi_xxx_managed_wep] State = idle
Any help would be appreciated.
[edit] A failure is likely to occur with 30 seconds or so of the action triggering the script, hence the script is required to terminate after 30 seconds. [/edit]