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; }