From: Marc Dionne Date: Thu, 25 Apr 2013 15:13:09 +0000 (-0400) Subject: salvageserver: Add -logfile option X-Git-Tag: upstream/1.8.0_pre1^2~1130 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=20a9568b508353ace1fa4d188673e3b686068344;p=packages%2Fo%2Fopenafs.git salvageserver: Add -logfile option Allow an alternate location to be specified for the logfile. Change-Id: I55a05576746e115478a8e48df22f4fdb26634f05 Reviewed-on: http://gerrit.openafs.org/9831 Tested-by: BuildBot Reviewed-by: Jeffrey Altman --- diff --git a/doc/man-pages/pod8/salvageserver.pod b/doc/man-pages/pod8/salvageserver.pod index a93a33e19..bd8e00aa5 100644 --- a/doc/man-pages/pod8/salvageserver.pod +++ b/doc/man-pages/pod8/salvageserver.pod @@ -290,6 +290,14 @@ directory. Salvageserver runs in client Mode. The requested volume on the requested partition will be scheduled for salvaging by the Salvageserver daemon. +=item B<-logfile> > + +Sets the file to use for server logging. If logfile is not specified and +no other logging options are supplied, this will be F. +Note that this option is intended for debugging and testing purposes. +Changing the location of the log file from the command line may result +in undesirable interactions with tools such as B. + =item B<-help> Prints the online help for this command. All other valid options are diff --git a/src/vol/salvaged.c b/src/vol/salvaged.c index bacc860d5..44ba9c2ea 100644 --- a/src/vol/salvaged.c +++ b/src/vol/salvaged.c @@ -110,6 +110,7 @@ #include #endif +char *logFileName = NULL; #if !defined(AFS_DEMAND_ATTACH_FS) #error "online salvager only supported for demand attach fileserver" @@ -183,6 +184,7 @@ enum optionsList { OPT_syslog, OPT_syslogfacility, OPT_datelogs, + OPT_logfile, OPT_client }; @@ -378,6 +380,8 @@ main(int argc, char **argv) arock.argc = argc; arock.argv = argv; + logFileName = strdup(AFSDIR_SERVER_SALSRVLOG_FILEPATH); + ts = cmd_CreateSyntax("initcmd", handleit, &arock, "initialize the program"); cmd_AddParmAtOffset(ts, OPT_partition, "-partition", CMD_SINGLE, CMD_OPTIONAL, "Name of partition to salvage"); @@ -418,6 +422,9 @@ main(int argc, char **argv) cmd_AddParmAtOffset(ts, OPT_client, "-client", CMD_FLAG, CMD_OPTIONAL, "Use SALVSYNC to ask salvageserver to salvage a volume"); + cmd_AddParmAtOffset(ts, OPT_logfile, "-logfile", CMD_SINGLE, CMD_OPTIONAL, + "Location of log file "); + err = cmd_Dispatch(argc, argv); Exit(err); return 0; /* not reached */ @@ -496,7 +503,7 @@ SalvageServer(int argc, char **argv) * multiple salvagers appending to the log. */ - CheckLogFile((char *)AFSDIR_SERVER_SALSRVLOG_FILEPATH); + CheckLogFile(logFileName); #ifndef AFS_NT40_ENV #ifdef AFS_LINUX20_ENV fcntl(fileno(logFile), F_SETFL, O_APPEND); /* Isn't this redundant? */