diff --git a/doc/CONFIGURATION.md b/doc/CONFIGURATION.md index 8c722f9..84fef65 100644 --- a/doc/CONFIGURATION.md +++ b/doc/CONFIGURATION.md @@ -20,6 +20,7 @@ when installing aprsc from a binary package. and debugging, or "syslog" for syslogd) * `-r logs` - log file directory, log files are placed in /opt/aprsc/logs * `-c etc/aprsc.conf` - configuration file location + * `-p /opt/aprsc/logs/aprsc.pid` - specify path to generated pid file, default path is logdir/aprsc.pid * `-y` - try to parse the configuration, report success or error, quit after reading configuration. Useful for validating your configuration before restarting aprsc. diff --git a/src/aprsc.c b/src/aprsc.c index 99d0eec..c53e19c 100644 --- a/src/aprsc.c +++ b/src/aprsc.c @@ -9,7 +9,7 @@ */ #define HELPS "Usage: aprsc [-t ] [-u ] [-c ] [-f (fork)]\n" \ - " [-n ] [-e ] [-o ] [-r ]\n" \ + " [-n ] [-e ] [-o ] [-r ] [-p ]\n" \ " [-y (try config)] [-h (help)]\n" #include @@ -83,7 +83,7 @@ void parse_cmdline(int argc, char *argv[]) int s, i; int failed = 0; - while ((s = getopt(argc, argv, "c:ft:u:n:r:d:DyZe:o:?h")) != -1) { + while ((s = getopt(argc, argv, "c:ft:u:n:r:d:DyZe:o:p:?h")) != -1) { switch (s) { case 'c': if (cfgfile && cfgfile != def_cfgfile) @@ -153,6 +153,11 @@ void parse_cmdline(int argc, char *argv[]) failed = 1; } break; + case 'p': + if (pidfile) + hfree(pidfile); + pidfile= hstrdup(optarg); + break; case '?': case 'h': fprintf(stderr, "%s\nBuilt at %s by %s\nBuilt with:%s\n",