Skip to content

Commit

Permalink
added daemon command line help
Browse files Browse the repository at this point in the history
  • Loading branch information
sy-c committed Jan 12, 2021
1 parent 9d096f3 commit 726204d
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/Daemon.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,17 @@ int createDaemon(int closeFiles)
return 0;
}

void print_usage()
{
printf("Daemon startup command line options:\n");
printf(" -z [pathToConfigurationFile] Define the path to the configuration file to be loaded.\n");
printf(" -o [key]=[value] Set an optional parameter, defined as a key/value pair.\n");
printf(" Possibly overwritten by corresponding content in configuration file [daemon] section\n");
printf(" Valid keys: isInteractive, idleSleepTime, userName, redirectOutput,\n");
printf(" logFile, logRotateMaxBytes, logRotateMaxFiles, logRotateNow.\n");
printf(" -h This help.\n");
}

Daemon::Daemon(int argc, char* argv[], DaemonConfigParameters* dConfigParams)
{
isInitialized = 0;
Expand All @@ -72,7 +83,7 @@ Daemon::Daemon(int argc, char* argv[], DaemonConfigParameters* dConfigParams)
try {
// parse command line parameters
int option;
while ((option = getopt(argc, argv, "z:o:")) != -1) {
while ((option = getopt(argc, argv, "z:o:h")) != -1) {
switch (option) {

case 'z':
Expand Down Expand Up @@ -119,6 +130,10 @@ Daemon::Daemon(int argc, char* argv[], DaemonConfigParameters* dConfigParams)
throw __LINE__;
}
} break;

case 'h': {
print_usage();
} break;

default:
throw __LINE__;
Expand Down

0 comments on commit 726204d

Please sign in to comment.