mirror of https://github.com/omar-polo/gmid.git
change the flags to be consistent with other OpenBSD daemons
-d is `debug' (run in the foreground) -f to load the configuration file adjust regress and contrib accordingly
This commit is contained in:
parent
3eabd37fe7
commit
aae8f6bf2b
|
@ -1,3 +1,7 @@
|
||||||
|
2022-09-08 Omar Polo <op@omarpolo.com>
|
||||||
|
|
||||||
|
* gmid.c (main): change the flags to be consisent with other OpenBSD daemons
|
||||||
|
|
||||||
2022-09-07 Omar Polo <op@omarpolo.com>
|
2022-09-07 Omar Polo <op@omarpolo.com>
|
||||||
|
|
||||||
* ge.c (main): add `ge': small program to quickly export a directory over Gemini.
|
* ge.c (main): add `ge': small program to quickly export a directory over Gemini.
|
||||||
|
|
|
@ -8,7 +8,7 @@ Wants=network-online.target
|
||||||
Type=simple
|
Type=simple
|
||||||
User=gmid
|
User=gmid
|
||||||
Group=nobody
|
Group=nobody
|
||||||
ExecStart=/usr/local/bin/gmid -f -c /etc/gmid.conf
|
ExecStart=/usr/local/bin/gmid -d -f /etc/gmid.conf
|
||||||
ExecStop=/bin/kill -TERM $MAINPID
|
ExecStop=/bin/kill -TERM $MAINPID
|
||||||
ExecReload=/bin/kill -HUP $MAINPID
|
ExecReload=/bin/kill -HUP $MAINPID
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
|
|
17
gmid.8
17
gmid.8
|
@ -20,9 +20,9 @@
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm
|
.Nm
|
||||||
.Bk -words
|
.Bk -words
|
||||||
.Op Fl fhnVv
|
.Op Fl dhnVv
|
||||||
.Op Fl c Ar config
|
|
||||||
.Op Fl D Ar macro Ns = Ns Ar value
|
.Op Fl D Ar macro Ns = Ns Ar value
|
||||||
|
.Op Fl f Ar config
|
||||||
.Op Fl P Ar pidfile
|
.Op Fl P Ar pidfile
|
||||||
.Ek
|
.Ek
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
|
@ -38,10 +38,6 @@ rereads the configuration file when it receives
|
||||||
.Pp
|
.Pp
|
||||||
The options are as follows:
|
The options are as follows:
|
||||||
.Bl -tag -width 14m
|
.Bl -tag -width 14m
|
||||||
.It Fl c Ar config
|
|
||||||
Specifies the configuration file.
|
|
||||||
The default is
|
|
||||||
.Pa /etc/gmid.conf .
|
|
||||||
.It Fl D Ar macro Ns = Ns Ar value
|
.It Fl D Ar macro Ns = Ns Ar value
|
||||||
Define
|
Define
|
||||||
.Ar macro
|
.Ar macro
|
||||||
|
@ -51,8 +47,13 @@ on the command line.
|
||||||
Overrides the definition of
|
Overrides the definition of
|
||||||
.Ar macro
|
.Ar macro
|
||||||
in the config file if present.
|
in the config file if present.
|
||||||
.It Fl f
|
.It Fl d
|
||||||
Stays and logs on the foreground.
|
Debug mode.
|
||||||
|
Do not daemonize and log to stderr.
|
||||||
|
.It Fl f Ar config
|
||||||
|
Specifies the configuration file.
|
||||||
|
The default is
|
||||||
|
.Pa /etc/gmid.conf .
|
||||||
.It Fl h , Fl -help
|
.It Fl h , Fl -help
|
||||||
Print the usage and exit.
|
Print the usage and exit.
|
||||||
.It Fl n
|
.It Fl n
|
||||||
|
|
14
gmid.c
14
gmid.c
|
@ -27,7 +27,7 @@
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
static const char *opts = "c:D:fhnP:Vv";
|
static const char *opts = "D:df:hnP:Vv";
|
||||||
|
|
||||||
static const struct option longopts[] = {
|
static const struct option longopts[] = {
|
||||||
{"help", no_argument, NULL, 'h'},
|
{"help", no_argument, NULL, 'h'},
|
||||||
|
@ -356,7 +356,7 @@ usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Version: " GMID_STRING "\n"
|
"Version: " GMID_STRING "\n"
|
||||||
"Usage: %s [-fnv] [-c config] [-D macro=value] [-P pidfile]\n",
|
"Usage: %s [-dhnVv] [-D macro=value] [-f config] [-P pidfile]\n",
|
||||||
getprogname());
|
getprogname());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -453,20 +453,20 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
while ((ch = getopt_long(argc, argv, opts, longopts, NULL)) != -1) {
|
while ((ch = getopt_long(argc, argv, opts, longopts, NULL)) != -1) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'c':
|
|
||||||
config_path = absolutify_path(optarg);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'D':
|
case 'D':
|
||||||
if (cmdline_symset(optarg) == -1)
|
if (cmdline_symset(optarg) == -1)
|
||||||
fatal("could not parse macro definition: %s",
|
fatal("could not parse macro definition: %s",
|
||||||
optarg);
|
optarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'f':
|
case 'd':
|
||||||
conf.foreground = 1;
|
conf.foreground = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'f':
|
||||||
|
config_path = absolutify_path(optarg);
|
||||||
|
break;
|
||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
usage();
|
usage();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -92,8 +92,8 @@ EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
checkconf() {
|
checkconf() {
|
||||||
if ! $gmid -n -c reg.conf >/dev/null 2>&1; then
|
if ! $gmid -n -f reg.conf >/dev/null 2>&1; then
|
||||||
$gmid -n -c reg.conf
|
$gmid -n -f reg.conf
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ run() {
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$gmid -P gmid.pid -c reg.conf
|
$gmid -P gmid.pid -f reg.conf
|
||||||
|
|
||||||
# give gmid time to bind the port, otherwise we end up
|
# give gmid time to bind the port, otherwise we end up
|
||||||
# executing gg when gmid isn't ready yet.
|
# executing gg when gmid isn't ready yet.
|
||||||
|
|
Loading…
Reference in New Issue