diff --git a/MAC/APL/CEPCU/src/CEPHardwareMonitor/CEPHardwareMonitorMain.cc b/MAC/APL/CEPCU/src/CEPHardwareMonitor/CEPHardwareMonitorMain.cc index 64b50993a527ac17702aae0049bab4a7f29b0241..e2a9fbc7d22e61a68fa7283a3b6c4a61844a5c96 100644 --- a/MAC/APL/CEPCU/src/CEPHardwareMonitor/CEPHardwareMonitorMain.cc +++ b/MAC/APL/CEPCU/src/CEPHardwareMonitor/CEPHardwareMonitorMain.cc @@ -36,49 +36,54 @@ using namespace LOFAR::CEPCU; int main(int argc, char* argv[]) { - // args: cntlrname, parentHost, parentService - GCFScheduler::instance()->init(argc, argv, "CEPHardwareMonitor"); + try { + // args: cntlrname, parentHost, parentService + GCFScheduler::instance()->init(argc, argv, "CEPHardwareMonitor"); - LOG_INFO("MACProcessScope: LOFAR_PermSW_HardwareMonitor"); - LOG_INFO(Version::getInfo<CEPCUVersion>("CEPHardwareMonitor")); + LOG_INFO("MACProcessScope: LOFAR_PermSW_HardwareMonitor"); + LOG_INFO(Version::getInfo<CEPCUVersion>("CEPHardwareMonitor")); - // Create tasks and call initial routines - BlueGeneMonitor* bgm(0); - ClusterMonitor* ctm(0); - - // monitor BLUEGENE? - if (globalParameterSet()->getUint32("WatchBlueGene",0)) { - bgm = new BlueGeneMonitor("BlueGeneMonitor"); - bgm->start(); - LOG_INFO("Monitoring the BlueGene"); - } + // Create tasks and call initial routines + BlueGeneMonitor* bgm(0); + ClusterMonitor* ctm(0); + + // monitor BLUEGENE? + if (globalParameterSet()->getUint32("WatchBlueGene",0)) { + bgm = new BlueGeneMonitor("BlueGeneMonitor"); + bgm->start(); + LOG_INFO("Monitoring the BlueGene"); + } - // monitor CEP2Cluster? - if (globalParameterSet()->getUint32("WatchCluster",0)) { - ctm = new ClusterMonitor("ClusterMonitor"); - ctm->start(); - LOG_INFO("Monitoring the Cluster"); - } + // monitor CEP2Cluster? + if (globalParameterSet()->getUint32("WatchCluster",0)) { + ctm = new ClusterMonitor("ClusterMonitor"); + ctm->start(); + LOG_INFO("Monitoring the Cluster"); + } - // sanity check - if (!bgm && !ctm) { - LOG_FATAL_STR("Non of the monitortask (WatchBlueGene, WatchCluster) " - "was switched on in the configfile, terminating program"); - return (0); - } + // sanity check + if (!bgm && !ctm) { + LOG_FATAL_STR("Non of the monitortask (WatchBlueGene, WatchCluster) " + "was switched on in the configfile, terminating program"); + return (0); + } - // ok, we have something to do, do it. - GCFScheduler::instance()->setDelayedQuit(true); // we need a clean shutdown - GCFScheduler::instance()->run(); // until stop was called + // ok, we have something to do, do it. + GCFScheduler::instance()->setDelayedQuit(true); // we need a clean shutdown + GCFScheduler::instance()->run(); // until stop was called - if (bgm) { - bgm->quit(); // let task quit nicely - } - if (ctm) { - ctm->quit(); // let task quit nicely + if (bgm) { + bgm->quit(); // let task quit nicely + } + if (ctm) { + ctm->quit(); // let task quit nicely + } + double postRunTime = globalParameterSet()->getDouble("closingDelay", 1.5); + GCFScheduler::instance()->run(postRunTime); // let processes die. + } catch( Exception &ex ) { + LOG_FATAL_STR("Caught exception: " << ex); + return 1; } - double postRunTime = globalParameterSet()->getDouble("closingDelay", 1.5); - GCFScheduler::instance()->run(postRunTime); // let processes die. return (0); } diff --git a/MAC/APL/CEPCU/src/CEPlogProcessor/CEPlogProcessorMain.cc b/MAC/APL/CEPCU/src/CEPlogProcessor/CEPlogProcessorMain.cc index 79d6d55cfa8b21488b43576deadea44cc8d2baea..146070a681404d3e1aa9a20039926418214f1dec 100644 --- a/MAC/APL/CEPCU/src/CEPlogProcessor/CEPlogProcessorMain.cc +++ b/MAC/APL/CEPCU/src/CEPlogProcessor/CEPlogProcessorMain.cc @@ -49,15 +49,11 @@ int main (int argc, char* argv[]) loggerTask.start(); // make initial transition GCFScheduler::instance()->run(); - - LOG_INFO_STR("Shutting down: " << argv[0]); } catch (LOFAR::Exception& ex) { LOG_FATAL_STR("Caught exception: " << ex); - LOG_FATAL ("Terminated by exception!"); return (1); } - LOG_INFO("Terminated normally"); return (0); } diff --git a/MAC/APL/CEPCU/src/OnlineControl/OnlineControlMain.cc b/MAC/APL/CEPCU/src/OnlineControl/OnlineControlMain.cc index 1a0dadbfb119ca7d17b1862b81eb7be052a8122b..a1daffe7a2df34771e53c0ce7385552c3a9f6403 100644 --- a/MAC/APL/CEPCU/src/OnlineControl/OnlineControlMain.cc +++ b/MAC/APL/CEPCU/src/OnlineControl/OnlineControlMain.cc @@ -42,15 +42,20 @@ int main(int argc, char* argv[]) return(-1); } - GCFScheduler::instance()->init(argc, argv, argv[1]); + try { + GCFScheduler::instance()->init(argc, argv, argv[1]); - ParentControl* pc = ParentControl::instance(); - pc->start(); // make initial transition + ParentControl* pc = ParentControl::instance(); + pc->start(); // make initial transition - OnlineControl olc(argv[1]); - olc.start(); // make initial transition + OnlineControl olc(argv[1]); + olc.start(); // make initial transition - GCFScheduler::instance()->run(); + GCFScheduler::instance()->run(); + } catch( Exception &ex ) { + LOG_FATAL_STR("Caught exception: " << ex); + return 1; + } return (0); } diff --git a/MAC/APL/CEPCU/src/PythonControl/PythonControlMain.cc b/MAC/APL/CEPCU/src/PythonControl/PythonControlMain.cc index 38bee7485f3e8e150128a8a402bd6bd1ae0b74ba..3ee05cbb8fdf0fc1c96ddf69190c729761d091c5 100644 --- a/MAC/APL/CEPCU/src/PythonControl/PythonControlMain.cc +++ b/MAC/APL/CEPCU/src/PythonControl/PythonControlMain.cc @@ -42,15 +42,20 @@ int main(int argc, char* argv[]) return(-1); } - GCFScheduler::instance()->init(argc, argv, "PythonControl"); + try { + GCFScheduler::instance()->init(argc, argv, "PythonControl"); - ParentControl* pc = ParentControl::instance(); - pc->start(); // make initial transition + ParentControl* pc = ParentControl::instance(); + pc->start(); // make initial transition - PythonControl pyc(argv[1]); - pyc.start(); // make initial transition + PythonControl pyc(argv[1]); + pyc.start(); // make initial transition - GCFScheduler::instance()->run(); + GCFScheduler::instance()->run(); + } catch( Exception &ex ) { + LOG_FATAL_STR("Caught exception: " << ex); + return 1; + } return (0); } diff --git a/MAC/APL/CEPCU/src/_OfflineControl/OfflineControlMain.cc b/MAC/APL/CEPCU/src/_OfflineControl/OfflineControlMain.cc index f827d1fedfbff9aef19b27e08e6fe62e95fb27cb..48941455ee2b756ad49f5ffc744ee1597eb90a65 100644 --- a/MAC/APL/CEPCU/src/_OfflineControl/OfflineControlMain.cc +++ b/MAC/APL/CEPCU/src/_OfflineControl/OfflineControlMain.cc @@ -38,15 +38,21 @@ int main(int argc, char* argv[]) printf("%s usage: %s <controller name>\n",argv[0],argv[0]); exit(-1); } - GCFTask::init(argc, argv); - ParentControl* pc = ParentControl::instance(); - pc->start(); // make initial transition + try { + GCFTask::init(argc, argv); - OfflineControl ofc(argv[1]); - ofc.start(); // make initial transition + ParentControl* pc = ParentControl::instance(); + pc->start(); // make initial transition - GCFTask::run(); + OfflineControl ofc(argv[1]); + ofc.start(); // make initial transition + + GCFTask::run(); + } catch( Exception &ex ) { + LOG_FATAL_STR("Caught exception: " << ex); + return 1; + } return 0; } diff --git a/MAC/APL/CUDaemons/src/CTStartDaemon/CTStartDaemonMain.cc b/MAC/APL/CUDaemons/src/CTStartDaemon/CTStartDaemonMain.cc index d78c0e9c4784d7c5a2554f017e6ccfd2a60fde8b..48b47c13aedc3b642327af449300352cf318983b 100644 --- a/MAC/APL/CUDaemons/src/CTStartDaemon/CTStartDaemonMain.cc +++ b/MAC/APL/CUDaemons/src/CTStartDaemon/CTStartDaemonMain.cc @@ -35,15 +35,20 @@ int main(int argc, char* argv[]) { // signal (SIGCHLD, SIG_IGN); - GCFScheduler::instance()->init(argc, argv, "CTStartDaemon"); + try { + GCFScheduler::instance()->init(argc, argv, "CTStartDaemon"); - LOG_INFO("MACProcessScope: LOFAR_PermSW_Daemons_CTStartDaemon"); + LOG_INFO("MACProcessScope: LOFAR_PermSW_Daemons_CTStartDaemon"); - CUDaemons::CTStartDaemon sd("StartDaemon"); // give myself a name + CUDaemons::CTStartDaemon sd("StartDaemon"); // give myself a name - sd.start(); // make initial transition + sd.start(); // make initial transition - GCFScheduler::instance()->run(); + GCFScheduler::instance()->run(); + } catch( Exception &ex ) { + LOG_FATAL_STR("Caught exception: " << ex); + return 1; + } return 0; } diff --git a/MAC/APL/CUDaemons/src/ServiceBroker/ServiceBrokerMain.cc b/MAC/APL/CUDaemons/src/ServiceBroker/ServiceBrokerMain.cc index cc23478288b343a04a449c0f6131eeba52bdf26b..fa9848e6985357e178cb252c9cd6d24f57697081 100644 --- a/MAC/APL/CUDaemons/src/ServiceBroker/ServiceBrokerMain.cc +++ b/MAC/APL/CUDaemons/src/ServiceBroker/ServiceBrokerMain.cc @@ -36,15 +36,20 @@ Exception::TerminateHandler t(Exception::terminate); int main(int argc, char *argv[]) { - GCFScheduler::instance()->init(argc, argv, "ServiceBroker"); - - LOG_INFO("MACProcessScope: LOFAR_PermSW_Daemons_ServiceBroker"); + try { + GCFScheduler::instance()->init(argc, argv, "ServiceBroker"); + + LOG_INFO("MACProcessScope: LOFAR_PermSW_Daemons_ServiceBroker"); - ServiceBroker sb; - - sb.start(); // make initial transition - - GCFScheduler::instance()->run(); + ServiceBroker sb; + + sb.start(); // make initial transition + + GCFScheduler::instance()->run(); + } catch( Exception &ex ) { + LOG_FATAL_STR("Caught exception: " << ex); + return 1; + } - return 0; + return 0; } diff --git a/MAC/APL/CURTDBDaemons/src/KeyValueLogger/KeyValueLoggerMain.cc b/MAC/APL/CURTDBDaemons/src/KeyValueLogger/KeyValueLoggerMain.cc index bfb6138b975dd939d9e8e3cb7cd5b02b6bec2bb0..10e89211e210afbd86b76e38289219758c586494 100644 --- a/MAC/APL/CURTDBDaemons/src/KeyValueLogger/KeyValueLoggerMain.cc +++ b/MAC/APL/CURTDBDaemons/src/KeyValueLogger/KeyValueLoggerMain.cc @@ -35,13 +35,18 @@ Exception::TerminateHandler t(Exception::terminate); int main(int argc, char *argv[]) { - GCFScheduler::instance()->init(argc, argv, "KeyValueLogger"); - LOG_INFO("MACProcessScope: LOFAR_PermSW_Daemons_KVLogger"); - - KeyValueLogger kvl("KeyValueLogger"); - kvl.start(); // make initial transition - - GCFScheduler::instance()->run(); + try { + GCFScheduler::instance()->init(argc, argv, "KeyValueLogger"); + LOG_INFO("MACProcessScope: LOFAR_PermSW_Daemons_KVLogger"); + + KeyValueLogger kvl("KeyValueLogger"); + kvl.start(); // make initial transition + + GCFScheduler::instance()->run(); + } catch( Exception &ex ) { + LOG_FATAL_STR("Caught exception: " << ex); + return 1; + } return (0); } diff --git a/MAC/APL/CURTDBDaemons/src/LogProcessor/LogProcessorMain.cc b/MAC/APL/CURTDBDaemons/src/LogProcessor/LogProcessorMain.cc index 65cd3c3ceddb4333eda0613478c95cc015df3471..9b4132e8c3b68ceec69a7e7867ea99796c836ba8 100644 --- a/MAC/APL/CURTDBDaemons/src/LogProcessor/LogProcessorMain.cc +++ b/MAC/APL/CURTDBDaemons/src/LogProcessor/LogProcessorMain.cc @@ -35,13 +35,18 @@ Exception::TerminateHandler t(Exception::terminate); int main(int argc, char *argv[]) { - GCFScheduler::instance()->init(argc, argv, "LogProcessor"); -// LOG_INFO("MACProcessScope: LOFAR_PermSW_Daemons_LogProcessor"); - - LogProcessor clp("LogProcessor"); - clp.start(); // make initial transition - - GCFScheduler::instance()->run(); + try { + GCFScheduler::instance()->init(argc, argv, "LogProcessor"); + // LOG_INFO("MACProcessScope: LOFAR_PermSW_Daemons_LogProcessor"); + + LogProcessor clp("LogProcessor"); + clp.start(); // make initial transition + + GCFScheduler::instance()->run(); + } catch( Exception &ex ) { + LOG_FATAL_STR("Caught exception: " << ex); + return 1; + } return (0); } diff --git a/MAC/APL/CURTDBDaemons/src/SASGateway/SASGatewayMain.cc b/MAC/APL/CURTDBDaemons/src/SASGateway/SASGatewayMain.cc index e7c3000739a1cd3acc7befd7d4740cca83226a40..d265a8f6b058d41f18639a9a2a82fe8c4189fd35 100644 --- a/MAC/APL/CURTDBDaemons/src/SASGateway/SASGatewayMain.cc +++ b/MAC/APL/CURTDBDaemons/src/SASGateway/SASGatewayMain.cc @@ -35,13 +35,18 @@ Exception::TerminateHandler t(Exception::terminate); int main(int argc, char *argv[]) { - GCFScheduler::instance()->init(argc, argv, "SASGateway"); - LOG_INFO("MACProcessScope: LOFAR_PermSW_Daemons_SASGateway"); - - SASGateway SGW("SASGateway"); - SGW.start(); // make initial transition - - GCFScheduler::instance()->run(); + try { + GCFScheduler::instance()->init(argc, argv, "SASGateway"); + LOG_INFO("MACProcessScope: LOFAR_PermSW_Daemons_SASGateway"); + + SASGateway SGW("SASGateway"); + SGW.start(); // make initial transition + + GCFScheduler::instance()->run(); + } catch( Exception &ex ) { + LOG_FATAL_STR("Caught exception: " << ex); + return 1; + } return (0); } diff --git a/MAC/APL/CURTDBDaemons/src/SoftwareMonitor/SoftwareMonitorMain.cc b/MAC/APL/CURTDBDaemons/src/SoftwareMonitor/SoftwareMonitorMain.cc index a1c9969cd39aefcf263acc2452843d0a418c049a..fe578f42de9fbb06606e0b87893c5cbd4a38a88f 100644 --- a/MAC/APL/CURTDBDaemons/src/SoftwareMonitor/SoftwareMonitorMain.cc +++ b/MAC/APL/CURTDBDaemons/src/SoftwareMonitor/SoftwareMonitorMain.cc @@ -40,28 +40,33 @@ Exception::TerminateHandler t(Exception::terminate); int main(int argc, char* argv[]) { - // args: cntlrname, parentHost, parentService - GCFScheduler::instance()->init(argc, argv, "SoftwareMonitor"); + try { + // args: cntlrname, parentHost, parentService + GCFScheduler::instance()->init(argc, argv, "SoftwareMonitor"); - LOG_INFO("MACProcessScope: LOFAR_PermSW_SoftwareMonitor"); - LOG_INFO(Version::getInfo<CURTDBDaemonsVersion>("SoftwareMonitor")); + LOG_INFO("MACProcessScope: LOFAR_PermSW_SoftwareMonitor"); + LOG_INFO(Version::getInfo<CURTDBDaemonsVersion>("SoftwareMonitor")); - // for debugging purposes - registerProtocol (DP_PROTOCOL, DP_PROTOCOL_STRINGS); + // for debugging purposes + registerProtocol (DP_PROTOCOL, DP_PROTOCOL_STRINGS); - // Create tasks and call initial routines - SoftwareMonitor* swm = new SoftwareMonitor("SoftwareMonitor"); - ASSERTSTR(swm, "Can't create an software monitortask"); - swm->start(); + // Create tasks and call initial routines + SoftwareMonitor* swm = new SoftwareMonitor("SoftwareMonitor"); + ASSERTSTR(swm, "Can't create an software monitortask"); + swm->start(); - // ok, we have something to do, do it. - GCFScheduler::instance()->setDelayedQuit(true); // we need a clean shutdown - GCFScheduler::instance()->run(); // until stop was called + // ok, we have something to do, do it. + GCFScheduler::instance()->setDelayedQuit(true); // we need a clean shutdown + GCFScheduler::instance()->run(); // until stop was called - swm->quit(); // let task quit nicely + swm->quit(); // let task quit nicely - double postRunTime = globalParameterSet()->getDouble("closingDelay", 1.5); - GCFScheduler::instance()->run(postRunTime); // let processes die. + double postRunTime = globalParameterSet()->getDouble("closingDelay", 1.5); + GCFScheduler::instance()->run(postRunTime); // let processes die. + } catch( Exception &ex ) { + LOG_FATAL_STR("Caught exception: " << ex); + return 1; + } return (0); } diff --git a/MAC/APL/MainCU/src/CRTriggerControl/TriggerControlMain.cc b/MAC/APL/MainCU/src/CRTriggerControl/TriggerControlMain.cc index 7fd6086d47c292ecdd95fd09da16a1cee8d4df23..19e80f6cc378bf4bec08c7f130f9853cacff9cc0 100644 --- a/MAC/APL/MainCU/src/CRTriggerControl/TriggerControlMain.cc +++ b/MAC/APL/MainCU/src/CRTriggerControl/TriggerControlMain.cc @@ -35,14 +35,18 @@ Exception::TerminateHandler t(Exception::terminate); int main(int argc, char* argv[]) { - - // args: cntlrname - GCFScheduler::instance()->init(argc, argv, argv[0]); - - TriggerControl tc(argv[0]); - tc.start(); // make initial transition - - GCFScheduler::instance()->run(); + try { + // args: cntlrname + GCFScheduler::instance()->init(argc, argv, argv[0]); + + TriggerControl tc(argv[0]); + tc.start(); // make initial transition + + GCFScheduler::instance()->run(); + } catch( Exception &ex ) { + LOG_FATAL_STR("Caught exception: " << ex); + return 1; + } return 0; } diff --git a/MAC/APL/MainCU/src/MACScheduler/MACSchedulerMain.cc b/MAC/APL/MainCU/src/MACScheduler/MACSchedulerMain.cc index 5f6b5ab611740cd6d905fcf605ffe06a88305c9b..d03e2036e340e3bc829865fa96bf144bf1a8fa7e 100644 --- a/MAC/APL/MainCU/src/MACScheduler/MACSchedulerMain.cc +++ b/MAC/APL/MainCU/src/MACScheduler/MACSchedulerMain.cc @@ -36,15 +36,20 @@ Exception::TerminateHandler t(Exception::terminate); int main(int argc, char* argv[]) { - GCFScheduler::instance()->init(argc, argv, "MACScheduler"); - - ChildControl* cc = ChildControl::instance(); - cc->start(); // make initial transition - - MACScheduler ms; - ms.start(); // make initial transition - - GCFScheduler::instance()->run(); + try { + GCFScheduler::instance()->init(argc, argv, "MACScheduler"); + + ChildControl* cc = ChildControl::instance(); + cc->start(); // make initial transition + + MACScheduler ms; + ms.start(); // make initial transition + + GCFScheduler::instance()->run(); + } catch( Exception &ex ) { + LOG_FATAL_STR("Caught exception: " << ex); + return 1; + } return 0; } diff --git a/MAC/APL/MainCU/src/ObservationControl/ObservationControlMain.cc b/MAC/APL/MainCU/src/ObservationControl/ObservationControlMain.cc index 7c52a1dce68ffbf319b2daf6e4837b9f902396f3..e3ed26971c012aaae0dc4df06a50dd57a39871dd 100644 --- a/MAC/APL/MainCU/src/ObservationControl/ObservationControlMain.cc +++ b/MAC/APL/MainCU/src/ObservationControl/ObservationControlMain.cc @@ -36,19 +36,24 @@ Exception::TerminateHandler t(Exception::terminate); int main(int argc, char* argv[]) { - // args: cntlrname, parentHost, parentService - GCFScheduler::instance()->init(argc, argv, argv[1]); + try { + // args: cntlrname, parentHost, parentService + GCFScheduler::instance()->init(argc, argv, argv[1]); - ChildControl* cc = ChildControl::instance(); - cc->start(); // make initial transition + ChildControl* cc = ChildControl::instance(); + cc->start(); // make initial transition - ParentControl* pc = ParentControl::instance(); - pc->start(); // make initial transition + ParentControl* pc = ParentControl::instance(); + pc->start(); // make initial transition - ObservationControl oc(argv[1]); - oc.start(); // make initial transition + ObservationControl oc(argv[1]); + oc.start(); // make initial transition - GCFScheduler::instance()->run(); + GCFScheduler::instance()->run(); + } catch( Exception &ex ) { + LOG_FATAL_STR("Caught exception: " << ex); + return 1; + } return 0; } diff --git a/MAC/APL/StationCU/src/BeamControl/BeamControlMain.cc b/MAC/APL/StationCU/src/BeamControl/BeamControlMain.cc index b6eab6f10ce6c4614fec117fd03e0d1546945448..b42ebef64418622035cabf50fe041321077be0b0 100644 --- a/MAC/APL/StationCU/src/BeamControl/BeamControlMain.cc +++ b/MAC/APL/StationCU/src/BeamControl/BeamControlMain.cc @@ -34,16 +34,21 @@ Exception::TerminateHandler t(Exception::terminate); int main(int argc, char* argv[]) { - // args: cntlrname, parentHost, parentService - GCFScheduler::instance()->init(argc, argv, argv[1]); + try { + // args: cntlrname, parentHost, parentService + GCFScheduler::instance()->init(argc, argv, argv[1]); - ParentControl* pc = ParentControl::instance(); - pc->start(); // make initial transition + ParentControl* pc = ParentControl::instance(); + pc->start(); // make initial transition - BeamControl bc(argv[1]); - bc.start(); // make initial transition + BeamControl bc(argv[1]); + bc.start(); // make initial transition - GCFScheduler::instance()->run(); + GCFScheduler::instance()->run(); + } catch( Exception &ex ) { + LOG_FATAL_STR("Caught exception: " << ex); + return 1; + } return 0; } diff --git a/MAC/APL/StationCU/src/CalibrationControl/CalibrationControlMain.cc b/MAC/APL/StationCU/src/CalibrationControl/CalibrationControlMain.cc index d6f05db5fba6edbc54b9fd47394b87275b09edf7..3fb2dac4b0b3b0f31a3a9fc7a89c3e373818c4ea 100644 --- a/MAC/APL/StationCU/src/CalibrationControl/CalibrationControlMain.cc +++ b/MAC/APL/StationCU/src/CalibrationControl/CalibrationControlMain.cc @@ -34,16 +34,21 @@ Exception::TerminateHandler t(Exception::terminate); int main(int argc, char* argv[]) { - // args: cntlrname, parentHost, parentService - GCFScheduler::instance()->init(argc, argv, argv[1]); + try { + // args: cntlrname, parentHost, parentService + GCFScheduler::instance()->init(argc, argv, argv[1]); - ParentControl* pc = ParentControl::instance(); - pc->start(); // make initial transition + ParentControl* pc = ParentControl::instance(); + pc->start(); // make initial transition - CalibrationControl cc(argv[1]); - cc.start(); // make initial transition + CalibrationControl cc(argv[1]); + cc.start(); // make initial transition - GCFScheduler::instance()->run(); + GCFScheduler::instance()->run(); + } catch( Exception &ex ) { + LOG_FATAL_STR("Caught exception: " << ex); + return 1; + } return 0; } diff --git a/MAC/APL/StationCU/src/ClockControl/ClockControlMain.cc b/MAC/APL/StationCU/src/ClockControl/ClockControlMain.cc index 23e3a6158a5e16f9e97c05c35a80e2b56f708055..6e3105283f9bac999db0f5e8e6e064aa86dffd3a 100644 --- a/MAC/APL/StationCU/src/ClockControl/ClockControlMain.cc +++ b/MAC/APL/StationCU/src/ClockControl/ClockControlMain.cc @@ -39,16 +39,21 @@ int main(int argc, char* argv[]) return (1); } - // args: cntlrname, parentHost, parentService - GCFScheduler::instance()->init(argc, argv, "ClockControl"); + try { + // args: cntlrname, parentHost, parentService + GCFScheduler::instance()->init(argc, argv, "ClockControl"); - ParentControl* pc = ParentControl::instance(); - pc->start(); // make initial transition + ParentControl* pc = ParentControl::instance(); + pc->start(); // make initial transition - ClockControl cc(argv[1]); - cc.start(); // make initial transition + ClockControl cc(argv[1]); + cc.start(); // make initial transition - GCFScheduler::instance()->run(); + GCFScheduler::instance()->run(); + } catch( Exception &ex ) { + LOG_FATAL_STR("Caught exception: " << ex); + return 1; + } return 0; } diff --git a/MAC/APL/StationCU/src/HardwareMonitor/HardwareMonitorMain.cc b/MAC/APL/StationCU/src/HardwareMonitor/HardwareMonitorMain.cc index f671ca5b3a421f529ff1bbb7034bdcf2c5824f7d..281322d4a6f98718a6e6cd639e695b2a87878732 100644 --- a/MAC/APL/StationCU/src/HardwareMonitor/HardwareMonitorMain.cc +++ b/MAC/APL/StationCU/src/HardwareMonitor/HardwareMonitorMain.cc @@ -42,65 +42,70 @@ Exception::TerminateHandler t(Exception::terminate); int main(int argc, char* argv[]) { - // args: cntlrname, parentHost, parentService - GCFScheduler::instance()->init(argc, argv, "HardwareMonitor"); + try { + // args: cntlrname, parentHost, parentService + GCFScheduler::instance()->init(argc, argv, "HardwareMonitor"); - LOG_INFO("MACProcessScope: LOFAR_PermSW_HardwareMonitor"); - LOG_INFO(Version::getInfo<StationCUVersion>("HardwareMonitor")); + LOG_INFO("MACProcessScope: LOFAR_PermSW_HardwareMonitor"); + LOG_INFO(Version::getInfo<StationCUVersion>("HardwareMonitor")); - // for debugging purposes - registerProtocol (RSP_PROTOCOL, RSP_PROTOCOL_STRINGS); - registerProtocol (TBB_PROTOCOL, TBB_PROTOCOL_STRINGS); - registerProtocol (DP_PROTOCOL, DP_PROTOCOL_STRINGS); + // for debugging purposes + registerProtocol (RSP_PROTOCOL, RSP_PROTOCOL_STRINGS); + registerProtocol (TBB_PROTOCOL, TBB_PROTOCOL_STRINGS); + registerProtocol (DP_PROTOCOL, DP_PROTOCOL_STRINGS); - // Create tasks and call initial routines - RSPMonitor* rsp(0); - TBBMonitor* tbb(0); - ECMonitor* ec(0); - - // monitor RSP? - if (globalParameterSet()->getUint32("WatchRSPboards",0)) { - rsp = new RSPMonitor("RSPMonitor"); - rsp->start(); - LOG_INFO("Monitoring the RSP boards"); - } + // Create tasks and call initial routines + RSPMonitor* rsp(0); + TBBMonitor* tbb(0); + ECMonitor* ec(0); + + // monitor RSP? + if (globalParameterSet()->getUint32("WatchRSPboards",0)) { + rsp = new RSPMonitor("RSPMonitor"); + rsp->start(); + LOG_INFO("Monitoring the RSP boards"); + } - // monitor TBB? - if (globalParameterSet()->getUint32("WatchTBboards",0)) { - tbb = new TBBMonitor("TBBMonitor"); - tbb->start(); - LOG_INFO("Monitoring the TB boards"); - } + // monitor TBB? + if (globalParameterSet()->getUint32("WatchTBboards",0)) { + tbb = new TBBMonitor("TBBMonitor"); + tbb->start(); + LOG_INFO("Monitoring the TB boards"); + } - // monitor EC? - if (globalParameterSet()->getUint32("WatchEnvCntrl",0)) { - ec = new ECMonitor("ECMonitor"); - ec->start(); - LOG_INFO("Monitoring the Environment Controller"); - } + // monitor EC? + if (globalParameterSet()->getUint32("WatchEnvCntrl",0)) { + ec = new ECMonitor("ECMonitor"); + ec->start(); + LOG_INFO("Monitoring the Environment Controller"); + } - // sanity check - if (!tbb && !rsp && !ec) { - LOG_FATAL_STR("Non of the monitortask (WatchRSPboards, WatchTBboards, WatchEnvCntrl) " - "was switched on in the configfile, terminating program"); - return (0); - } + // sanity check + if (!tbb && !rsp && !ec) { + LOG_FATAL_STR("Non of the monitortask (WatchRSPboards, WatchTBboards, WatchEnvCntrl) " + "was switched on in the configfile, terminating program"); + return (0); + } - // ok, we have something to do, do it. - GCFScheduler::instance()->setDelayedQuit(true); // we need a clean shutdown - GCFScheduler::instance()->run(); // until stop was called + // ok, we have something to do, do it. + GCFScheduler::instance()->setDelayedQuit(true); // we need a clean shutdown + GCFScheduler::instance()->run(); // until stop was called - if (rsp) { - rsp->quit(); // let task quit nicely - } - if (tbb) { - tbb->quit(); // let task quit nicely - } - if (ec) { - ec->quit(); // let task quit nicely + if (rsp) { + rsp->quit(); // let task quit nicely + } + if (tbb) { + tbb->quit(); // let task quit nicely + } + if (ec) { + ec->quit(); // let task quit nicely + } + double postRunTime = globalParameterSet()->getDouble("closingDelay", 1.5); + GCFScheduler::instance()->run(postRunTime); // let processes die. + } catch( Exception &ex ) { + LOG_FATAL_STR("Caught exception: " << ex); + return 1; } - double postRunTime = globalParameterSet()->getDouble("closingDelay", 1.5); - GCFScheduler::instance()->run(postRunTime); // let processes die. return (0); } diff --git a/MAC/APL/StationCU/src/StationControl/StationControlMain.cc b/MAC/APL/StationCU/src/StationControl/StationControlMain.cc index 38ff113ea9e627c501b9ae2e5eaa6a946e4f8969..f199efe9479233092cfcf823b57fe4c4c92dde7f 100644 --- a/MAC/APL/StationCU/src/StationControl/StationControlMain.cc +++ b/MAC/APL/StationCU/src/StationControl/StationControlMain.cc @@ -37,26 +37,31 @@ int main(int argc, char* argv[]) { using LOFAR::basename; - // args: cntlrname, parentHost, parentService - GCFScheduler::instance()->init(argc, argv, basename(argv[0])); + try { + // args: cntlrname, parentHost, parentService + GCFScheduler::instance()->init(argc, argv, basename(argv[0])); - ParentControl* pc = ParentControl::instance(); - pc->start(); // make initial transition + ParentControl* pc = ParentControl::instance(); + pc->start(); // make initial transition - ChildControl* cc = ChildControl::instance(); - cc->start(); // make initial transition + ChildControl* cc = ChildControl::instance(); + cc->start(); // make initial transition - string myName; - if (argc < 2) { // started by swlevel? - myName = myHostname(false) + ":" + basename(argv[0]); - } - else { - myName = argv[1]; - } - StationControl sc(myName.c_str()); - sc.start(); // make initial transition + string myName; + if (argc < 2) { // started by swlevel? + myName = myHostname(false) + ":" + basename(argv[0]); + } + else { + myName = argv[1]; + } + StationControl sc(myName.c_str()); + sc.start(); // make initial transition - GCFScheduler::instance()->run(); + GCFScheduler::instance()->run(); + } catch( Exception &ex ) { + LOG_FATAL_STR("Caught exception: " << ex); + return 1; + } return 0; } diff --git a/MAC/APL/StationCU/src/TBBControl/TBBControlMain.cc b/MAC/APL/StationCU/src/TBBControl/TBBControlMain.cc index 8b99850b0e7775ca5bca42d05dc256d5cc65d467..162fcef5388c449a8a4ae84f592825620fd1a589 100644 --- a/MAC/APL/StationCU/src/TBBControl/TBBControlMain.cc +++ b/MAC/APL/StationCU/src/TBBControl/TBBControlMain.cc @@ -34,17 +34,22 @@ Exception::TerminateHandler t(Exception::terminate); int main(int argc, char* argv[]) { - // args: cntlrname, parentHost, parentService - GCFScheduler::instance()->init(argc, argv, argv[0]); - GCFScheduler::instance()->disableQueue(); // run as fast as possible - - ParentControl* pc = ParentControl::instance(); - pc->start(); // make initial transition - - TBBControl tc(argv[1]); - tc.start(); // make initial transition - - GCFScheduler::instance()->run(); + try { + // args: cntlrname, parentHost, parentService + GCFScheduler::instance()->init(argc, argv, argv[0]); + GCFScheduler::instance()->disableQueue(); // run as fast as possible + + ParentControl* pc = ParentControl::instance(); + pc->start(); // make initial transition + + TBBControl tc(argv[1]); + tc.start(); // make initial transition + + GCFScheduler::instance()->run(); + } catch( Exception &ex ) { + LOG_FATAL_STR("Caught exception: " << ex); + return 1; + } return 0; }