Hello,
I'm trying to write a simple script that monitors starting and stopping an application. It would then send an appropriate message using MQTT on my network. For instance, to automatically turn on and off some lights using Home Assistant. The latter runs on a RPi.
The application in question is OBS and i can detect the start and stop events using the following log commands:
log stream --predicate 'composedMessage contains "com.obsproject.obs-studio" and composedMessage contains "CHECKIN"'
log stream --predicate 'composedMessage contains "Removing process: [app<application.com.obsproject.obs-studio"'
I would like the log to exit as soon as the requested event is triggered. I could then use MQTT to send an appropriate message to the broker.
Any help on how to exit logging would be much appreciated!
Ted.
I'm trying to write a simple script that monitors starting and stopping an application. It would then send an appropriate message using MQTT on my network. For instance, to automatically turn on and off some lights using Home Assistant. The latter runs on a RPi.
The application in question is OBS and i can detect the start and stop events using the following log commands:
log stream --predicate 'composedMessage contains "com.obsproject.obs-studio" and composedMessage contains "CHECKIN"'
log stream --predicate 'composedMessage contains "Removing process: [app<application.com.obsproject.obs-studio"'
I would like the log to exit as soon as the requested event is triggered. I could then use MQTT to send an appropriate message to the broker.
Any help on how to exit logging would be much appreciated!
Ted.