Add support for defining pid file as a command line argument
Signed-off-by: David Schadlich <dschadlich@gmail.com>
This commit is contained in:
parent
f8824e85f7
commit
74ed31711c
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Reference in New Issue