Belle II Software development
Daemon Class Reference

Static Public Member Functions

static bool start (const char *title, int argc, char **argv, int nargc, const char *msg)
 
static bool restart ()
 

Static Private Attributes

static int g_argc = 0
 
static char ** g_argv = NULL
 

Detailed Description

Definition at line 17 of file Daemon.h.

Member Function Documentation

◆ restart()

bool restart ( )
static

Definition at line 47 of file Daemon.cc.

48{
49 return execv(g_argv[0], g_argv) != -1;
50}

◆ start()

bool start ( const char *  title,
int  argc,
char **  argv,
int  nargc,
const char *  msg 
)
static

Definition at line 19 of file Daemon.cc.

22{
23 g_argc = argc;
24 g_argv = argv;
25 bool isdaemon = false;
26 for (int i = 1; i < argc; i++) {
27 if (strcmp(argv[i], "-d") == 0) {
28 isdaemon = true;
29 nargc++;
30 } else if (strcmp(argv[i], "-h") == 0) {
31 LogFile::debug("Usage : %s %s [-d]", argv[0], msg);
32 return false;
33 }
34 }
35 if (argc < nargc + 1) {
36 LogFile::debug("Usage : %s %s [-d]", argv[0], msg);
37 return false;
38 }
39 LogFile::open(StringUtil::form("%s/%s", argv[0], title));
40 if (isdaemon) {
41 daemon(0, 0);
42 }
43 return true;
44}

Member Data Documentation

◆ g_argc

int g_argc = 0
staticprivate

Definition at line 27 of file Daemon.h.

◆ g_argv

char ** g_argv = NULL
staticprivate

Definition at line 28 of file Daemon.h.


The documentation for this class was generated from the following files: