Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
FMDbMonitor_linux
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guanghui.cui
FMDbMonitor_linux
Commits
aaef36b8
Commit
aaef36b8
authored
Nov 09, 2017
by
guanghui.cui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
程序启动后,pid写入配置文件(程序更新时需要,如果不写入,程序更新后程序重启,pid和守护进程记录的不一致,造成守护进程无法监控程序的问题)
parent
ae18c821
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletions
+11
-1
src/FMDbMonitor.cpp
+11
-1
No files found.
src/FMDbMonitor.cpp
View file @
aaef36b8
...
@@ -6,12 +6,14 @@
...
@@ -6,12 +6,14 @@
#include <errno.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/socket.h>
#include <sys/syscall.h>
#include <netinet/in.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <unistd.h>
#include <pthread.h>
#include <pthread.h>
#include <ifaddrs.h>
#include <ifaddrs.h>
#include <string.h>
#include <string.h>
#include <fstream>
#include "../base/FM_ErrorCode.h"
#include "../base/FM_ErrorCode.h"
#include "SQLiteOperate.h"
#include "SQLiteOperate.h"
#include "PayProcess.h"
#include "PayProcess.h"
...
@@ -22,7 +24,7 @@
...
@@ -22,7 +24,7 @@
#define ELPP_NO_DEFAULT_LOG_FILE
#define ELPP_NO_DEFAULT_LOG_FILE
#include "../3rdParty/easylogging/easylogging++.h"
#include "../3rdParty/easylogging/easylogging++.h"
using
namespace
std
;
#define BUFFER_SIZE 1024 //缓冲区大小
#define BUFFER_SIZE 1024 //缓冲区大小
void
InitSystem
();
void
InitSystem
();
void
Init
();
void
Init
();
...
@@ -64,6 +66,14 @@ int main()
...
@@ -64,6 +66,14 @@ int main()
//SetUnhandledExceptionFilter(FMExcpHandler);
//SetUnhandledExceptionFilter(FMExcpHandler);
signal
(
SIGINT
,
app_stopped
);
signal
(
SIGINT
,
app_stopped
);
LOG
(
INFO
)
<<
"启动 FMDbMonitor"
;
LOG
(
INFO
)
<<
"启动 FMDbMonitor"
;
pid_t
tid
;
tid
=
syscall
(
SYS_gettid
);
std
::
string
strPidPath
=
GetProcDir
();
strPidPath
.
append
(
"pidMonitor.txt"
);
LOG
(
INFO
)
<<
"get process pid:"
<<
tid
<<
" file name:"
<<
strPidPath
.
data
();
fstream
f
(
strPidPath
.
c_str
(),
ios
::
out
);
f
<<
tid
;
f
.
close
();
int
nrlt
=
EC_OK
;
int
nrlt
=
EC_OK
;
while
(
dbOperation
->
DBConnect
()
!=
EC_OK
)
while
(
dbOperation
->
DBConnect
()
!=
EC_OK
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment