Merge pull request #62 from dschadlich/master
Add support for defining pid file as a command line argument
This commit is contained in:
commit
ecaa9469ad
|
|
@ -20,6 +20,7 @@ when installing aprsc from a binary package.
|
||||||
and debugging, or "syslog" for syslogd)
|
and debugging, or "syslog" for syslogd)
|
||||||
* `-r logs` - log file directory, log files are placed in /opt/aprsc/logs
|
* `-r logs` - log file directory, log files are placed in /opt/aprsc/logs
|
||||||
* `-c etc/aprsc.conf` - configuration file location
|
* `-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,
|
* `-y` - try to parse the configuration, report success or error,
|
||||||
quit after reading configuration. Useful for validating your
|
quit after reading configuration. Useful for validating your
|
||||||
configuration before restarting aprsc.
|
configuration before restarting aprsc.
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define HELPS "Usage: aprsc [-t <chrootdir>] [-u <setuid user>] [-c <cfgfile>] [-f (fork)]\n" \
|
#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"
|
" [-y (try config)] [-h (help)]\n"
|
||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
@ -83,7 +83,7 @@ void parse_cmdline(int argc, char *argv[])
|
||||||
int s, i;
|
int s, i;
|
||||||
int failed = 0;
|
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) {
|
switch (s) {
|
||||||
case 'c':
|
case 'c':
|
||||||
if (cfgfile && cfgfile != def_cfgfile)
|
if (cfgfile && cfgfile != def_cfgfile)
|
||||||
|
|
@ -153,6 +153,11 @@ void parse_cmdline(int argc, char *argv[])
|
||||||
failed = 1;
|
failed = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'p':
|
||||||
|
if (pidfile)
|
||||||
|
hfree(pidfile);
|
||||||
|
pidfile= hstrdup(optarg);
|
||||||
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
case 'h':
|
case 'h':
|
||||||
fprintf(stderr, "%s\nBuilt at %s by %s\nBuilt with:%s\n",
|
fprintf(stderr, "%s\nBuilt at %s by %s\nBuilt with:%s\n",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue