Print out an error when a monitor is in MONITOR mode because we can't handle alarms. Allow signals to terminate zmu by checking zm_terminate.
This commit is contained in:
parent
77eb15ff17
commit
847cd9f347
20
src/zmu.cpp
20
src/zmu.cpp
|
@ -571,14 +571,18 @@ int main(int argc, char *argv[]) {
|
|||
monitor->DumpZoneImage(zoneString);
|
||||
}
|
||||
if ( function & ZMU_ALARM ) {
|
||||
if ( verbose )
|
||||
printf("Forcing alarm on\n");
|
||||
monitor->ForceAlarmOn(config.forced_alarm_score, "Forced Web");
|
||||
while ( monitor->GetState() != Monitor::ALARM ) {
|
||||
// Wait for monitor to notice.
|
||||
usleep(1000);
|
||||
}
|
||||
printf("Alarmed event id: %" PRIu64 "\n", monitor->GetLastEventId());
|
||||
if ( monitor->GetFunction() == Monitor::Function::MONITOR ) {
|
||||
printf("A Monitor in monitor mode cannot handle alarms. Please use NoDect\n");
|
||||
} else {
|
||||
if ( verbose )
|
||||
printf("Forcing alarm on\n");
|
||||
monitor->ForceAlarmOn(config.forced_alarm_score, "Forced Web");
|
||||
while ( (monitor->GetState() != Monitor::ALARM) && !zm_terminate ) {
|
||||
// Wait for monitor to notice.
|
||||
usleep(1000);
|
||||
}
|
||||
printf("Alarmed event id: %" PRIu64 "\n", monitor->GetLastEventId());
|
||||
} // end if ! MONITOR
|
||||
}
|
||||
if ( function & ZMU_NOALARM ) {
|
||||
if ( verbose )
|
||||
|
|
Loading…
Reference in New Issue