Merge pull request #62 from dschadlich/master

Add support for defining pid file as a command line argument
This commit is contained in:
Heikki Hannikainen 2021-01-30 22:39:27 +02:00 committed by GitHub
commit ecaa9469ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -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.

View File

@ -9,7 +9,7 @@
*/
#define HELPS "Usage: aprsc [-t <chrootdir>] [-u <setuid user>] [-c <cfgfile>] [-f (fork)]\n" \
" [-n <logname>] [-e <loglevel>] [-o <logdest>] [-r <logdir>]\n" \
" [-n <logname>] [-e <loglevel>] [-o <logdest>] [-r <logdir>] [-p <pidfile>]\n" \
" [-y (try config)] [-h (help)]\n"
#include <pthread.h>
@ -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",