You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
2.3 KiB

12 months ago
12 months ago
8 months ago
12 months ago
8 months ago
8 months ago
8 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
8 months ago
12 months ago
12 months ago
12 months ago
  1. #include <signal.h>
  2. #include <sqlite3.h>
  3. #include "appbase/appbase.hpp"
  4. #include "appconfig/appconfig.hpp"
  5. #include "service/app_core.hpp"
  6. //
  7. #include "appconfig/appconfig.hpp"
  8. #include "appconfig/basic/zappversion.hpp"
  9. using namespace iflytop;
  10. using namespace core;
  11. using namespace std;
  12. namespace iflytop {
  13. using namespace iflytop;
  14. using namespace core;
  15. using namespace std;
  16. class Main {
  17. THISCLASS(Main);
  18. private:
  19. unique_ptr<Thread> thread;
  20. private:
  21. int main(int argc, char *argv[]);
  22. public:
  23. static Main *g_main;
  24. static void _onsignal(int signo) { g_main->onsignal(signo); }
  25. void onsignal(int signo);
  26. public:
  27. Main(/* args */) {}
  28. ~Main() {}
  29. void run(int argc, char *argv[]);
  30. void dosystem(string order, bool dump) {
  31. if (dump) logger->info("{}", order);
  32. system(order.c_str());
  33. }
  34. };
  35. }; // namespace iflytop
  36. /*******************************************************************************
  37. * MAIN => MAIN *
  38. *******************************************************************************/
  39. Main *Main::g_main;
  40. extern "C" {
  41. int main(int argc, char *argv[]) {
  42. Main main;
  43. Main::g_main = &main;
  44. main.run(argc, argv);
  45. }
  46. }
  47. namespace iflytop {}
  48. void Main::onsignal(int signo) { exit(0); }
  49. void Main::run(int argc, char *argv[]) {
  50. // ::signal(SIGINT, Main::_onsignal);
  51. thread.reset(new Thread("main", [&]() { exit(main(argc, argv)); }));
  52. while (true) sleep(1000);
  53. }
  54. int Main::main(int argc, char *argv[]) {
  55. /**
  56. * @brief
  57. */
  58. logger->info("system setup start.");
  59. spdlog::flush_on(spdlog::level::debug);
  60. logger->info("#");
  61. logger->info("# company:{}", "ifytop");
  62. logger->info("# version:{}", VERSION);
  63. logger->info("# project:{}", PROJECT_NAME);
  64. logger->info("#");
  65. logger->info("build {}.....", "Config");
  66. logger->info("VolumeConvertor::largeSpaceParam:{}", VolumeConvertor(VolumeConvertor::largeSpaceParam).getFullVolumeG());
  67. logger->info("VolumeConvertor::smallSpaceParam:{}", VolumeConvertor(VolumeConvertor::smallSpaceParam).getFullVolumeG());
  68. logger->info("VolumeConvertor::pipeParam:{}", VolumeConvertor(VolumeConvertor::pipeParam).getFullVolumeG());
  69. // 构造MainControlService
  70. BUILD_AND_REG_SERRVICE(AppCore);
  71. logger->info("system setup end.");
  72. while (true) sleep(1000);
  73. }