Skip to content

Commit 726204d

Browse files
committed
added daemon command line help
1 parent 9d096f3 commit 726204d

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

src/Daemon.cxx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,17 @@ int createDaemon(int closeFiles)
6161
return 0;
6262
}
6363

64+
void print_usage()
65+
{
66+
printf("Daemon startup command line options:\n");
67+
printf(" -z [pathToConfigurationFile] Define the path to the configuration file to be loaded.\n");
68+
printf(" -o [key]=[value] Set an optional parameter, defined as a key/value pair.\n");
69+
printf(" Possibly overwritten by corresponding content in configuration file [daemon] section\n");
70+
printf(" Valid keys: isInteractive, idleSleepTime, userName, redirectOutput,\n");
71+
printf(" logFile, logRotateMaxBytes, logRotateMaxFiles, logRotateNow.\n");
72+
printf(" -h This help.\n");
73+
}
74+
6475
Daemon::Daemon(int argc, char* argv[], DaemonConfigParameters* dConfigParams)
6576
{
6677
isInitialized = 0;
@@ -72,7 +83,7 @@ Daemon::Daemon(int argc, char* argv[], DaemonConfigParameters* dConfigParams)
7283
try {
7384
// parse command line parameters
7485
int option;
75-
while ((option = getopt(argc, argv, "z:o:")) != -1) {
86+
while ((option = getopt(argc, argv, "z:o:h")) != -1) {
7687
switch (option) {
7788

7889
case 'z':
@@ -119,6 +130,10 @@ Daemon::Daemon(int argc, char* argv[], DaemonConfigParameters* dConfigParams)
119130
throw __LINE__;
120131
}
121132
} break;
133+
134+
case 'h': {
135+
print_usage();
136+
} break;
122137

123138
default:
124139
throw __LINE__;

0 commit comments

Comments
 (0)