-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPsmonDaemon.hpp
44 lines (37 loc) · 1007 Bytes
/
PsmonDaemon.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
NAME
PsmonDaemon.hpp - Header file of the PSMON daemon class.
DESCRIPTION
Processing monitor daemon program.
*/
#ifndef __PSMON_DAEMON_HPP__
#define __PSMON_DAEMON_HPP__
#include "BaseDaemon.hpp"
#include "Logger.hpp"
#include "ProcessManager.hpp"
#include <string>
#include <semaphore.h>
#define S_CMD_STATUS "cmd:status"
#define S_CMD_START "cmd:start"
#define S_CMD_STOP "cmd:stop"
#define S_CMD_RESTART "cmd:restart"
#define S_CMD_RELOAD "cmd:reload"
#define S_SYNTAX_ERROR "SYNTAX ERROR"
class PsmonDaemon : public BaseDaemon
{
public:
static PsmonDaemon* instance(const std::string& daemon_name, bool daemon_mode);
static void destory();
static void version();
PsmonDaemon(const std::string& daemon_name, bool daemon_mode);
virtual ~PsmonDaemon();
virtual bool init();
virtual bool prepare();
virtual void process();
protected:
static PsmonDaemon* _instance;
private:
static sem_t* _semaphore;
ProcessManager* _ps_man;
};
#endif