mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-22 12:52:33 +00:00
asterisk.c: Warn of incompatibilities with remote console.
Some command line options to Asterisk only apply when Asterisk is started and cannot be used with remote console mode. If a user tries to use any of these, they are currently simply silently ignored. This prints out a warning if incompatible options are used, informing users that an option used cannot be used with remote console mode. Additionally, some clarifications are added to the help text and man page. ASTERISK-22246 ASTERISK-26582 Change-Id: I980a5380ef2c19e8ea348596396d5382893c4337
This commit is contained in:
committed by
Joshua Colp
parent
306ce09df2
commit
4585a9c3b8
@@ -3351,7 +3351,7 @@ static int show_cli_help(void)
|
||||
printf(" -L <load> Limit the maximum load average before rejecting new calls\n");
|
||||
printf(" -M <value> Limit the maximum number of calls to the specified value\n");
|
||||
printf(" -m Mute debugging and console output on the console\n");
|
||||
printf(" -n Disable console colorization\n");
|
||||
printf(" -n Disable console colorization. Can be used only at startup.\n");
|
||||
printf(" -p Run as pseudo-realtime thread\n");
|
||||
printf(" -q Quiet mode (suppress output)\n");
|
||||
printf(" -r Connect to Asterisk on this machine\n");
|
||||
@@ -3360,7 +3360,7 @@ static int show_cli_help(void)
|
||||
printf(" -t Record soundfiles in /var/tmp and move them where they\n");
|
||||
printf(" belong after they are done\n");
|
||||
printf(" -T Display the time in [Mmm dd hh:mm:ss] format for each line\n");
|
||||
printf(" of output to the CLI\n");
|
||||
printf(" of output to the CLI. Cannot be used with remote console mode.\n\n");
|
||||
printf(" -v Increase verbosity (multiple v's = more verbose)\n");
|
||||
printf(" -x <cmd> Execute command <cmd> (implies -r)\n");
|
||||
printf(" -X Enable use of #exec in asterisk.conf\n");
|
||||
@@ -3716,6 +3716,55 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
if (ast_opt_remote) {
|
||||
int didwarn = 0;
|
||||
optind = 1;
|
||||
|
||||
/* Not all options can be used with remote console. Warn if they're used. */
|
||||
while ((c = getopt(argc, argv, getopt_settings)) != -1) {
|
||||
switch (c) {
|
||||
/* okay to run with remote console */
|
||||
case 'B': /* force black background */
|
||||
case 'd': /* debug */
|
||||
case 'h': /* help */
|
||||
case 'I': /* obsolete timing option: warning already thrown if used */
|
||||
case 'L': /* max load */
|
||||
case 'M': /* max calls */
|
||||
case 'R': /* reconnect */
|
||||
case 'r': /* remote */
|
||||
case 's': /* set socket path */
|
||||
case 'V': /* version */
|
||||
case 'v': /* verbose */
|
||||
case 'W': /* white background */
|
||||
case 'x': /* remote execute */
|
||||
case '?': /* ? */
|
||||
break;
|
||||
/* can only be run when Asterisk is starting */
|
||||
case 'X': /* enables #exec for asterisk.conf only. */
|
||||
case 'C': /* set config path */
|
||||
case 'c': /* foreground console */
|
||||
case 'e': /* minimum memory free */
|
||||
case 'F': /* always fork */
|
||||
case 'f': /* no fork */
|
||||
case 'G': /* run group */
|
||||
case 'g': /* dump core */
|
||||
case 'i': /* init keys */
|
||||
case 'm': /* mute */
|
||||
case 'n': /* no color */
|
||||
case 'p': /* high priority */
|
||||
case 'q': /* quiet */
|
||||
case 'T': /* timestamp */
|
||||
case 't': /* cache record files */
|
||||
case 'U': /* run user */
|
||||
fprintf(stderr, "'%c' option is not compatible with remote console mode and has no effect.\n", c);
|
||||
didwarn = 1;
|
||||
}
|
||||
}
|
||||
if (didwarn) {
|
||||
fprintf(stderr, "\n"); /* if any warnings print out, make them stand out */
|
||||
}
|
||||
}
|
||||
|
||||
/* For remote connections, change the name of the remote connection.
|
||||
* We do this for the benefit of init scripts (which need to know if/when
|
||||
* the main asterisk process has died yet). */
|
||||
|
Reference in New Issue
Block a user