dogcore.cpp 753 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #include "dogcore.h"
  2. #include "datacollector.h"
  3. DogCore::DogCore(QObject *parent) : QObject(parent)
  4. {
  5. hour = 255;
  6. timer = new QTimer(this);
  7. connect(timer,&QTimer::timeout,this,&DogCore::time_out);
  8. }
  9. DogCore::~DogCore()
  10. {
  11. }
  12. void DogCore::time_out()
  13. {
  14. chkTime = QDateTime::currentDateTime().toTime_t();
  15. if((chkTime - dataColShm->time)>30){
  16. if((system("killall ytDataCollectorCore")) != -1){
  17. system("/root/bin/ytDataCollectorCore &");
  18. }
  19. }
  20. if((chkTime - dataColShm->influtime)>30){
  21. if((system("killall ytDeviceTypeInfluxdbWriter")) != -1){
  22. system("/root/bin/ytDeviceTypeInfluxdbWriter &");
  23. }
  24. }
  25. }
  26. void DogCore::start()
  27. {
  28. time_out();
  29. timer->start(5000);
  30. }