summaryrefslogtreecommitdiff
path: root/source3/wrepld
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2003-01-03 17:32:11 +0000
committerGerald Carter <jerry@samba.org>2003-01-03 17:32:11 +0000
commitdf4af79c784fa3dbc14c8ca2eefc51c78a22e26b (patch)
treebab44414072172eee3c14b1ba758e9f7a4043e7c /source3/wrepld
parentfc744091d4cddb49024c542b77d140f2cb6cef4f (diff)
downloadsamba-df4af79c784fa3dbc14c8ca2eefc51c78a22e26b.tar.gz
samba-df4af79c784fa3dbc14c8ca2eefc51c78a22e26b.tar.bz2
samba-df4af79c784fa3dbc14c8ca2eefc51c78a22e26b.zip
patch to include support for daemontools from Michael Handler
(This used to be commit 4c48c475a28450ad4fd8dcc8263e841c0c39a80e)
Diffstat (limited to 'source3/wrepld')
-rw-r--r--source3/wrepld/server.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/source3/wrepld/server.c b/source3/wrepld/server.c
index e39fb148d6..349f2a21ab 100644
--- a/source3/wrepld/server.c
+++ b/source3/wrepld/server.c
@@ -166,9 +166,11 @@ void exit_server(const char *reason)
static void usage(char *pname)
{
- d_printf("Usage: %s [-DaioPh?V] [-d debuglevel] [-l log basename] [-p port]\n", pname);
+ d_printf("Usage: %s [-DFSaioPh?V] [-d debuglevel] [-l log basename] [-p port]\n", pname);
d_printf(" [-O socket options] [-s services file]\n");
d_printf("\t-D Become a daemon (default)\n");
+ d_printf("\t-F Run daemon in foreground (for daemontools, etc)\n");
+ d_printf("\t-S Log to stdout\n");
d_printf("\t-a Append to log file (default)\n");
d_printf("\t-i Run interactive (not a daemon)\n" );
d_printf("\t-o Overwrite log file, don't append\n");
@@ -523,6 +525,8 @@ static void process(void)
BOOL is_daemon = False;
BOOL interactive = False;
BOOL specified_logfile = False;
+ BOOL Fork = True;
+ BOOL log_stdout = False;
int opt;
pstring logfile;
@@ -536,8 +540,14 @@ static void process(void)
argc--;
}
- while ( EOF != (opt = getopt(argc, argv, "O:l:s:d:Dp:h?Vaiof:")) )
+ while ( EOF != (opt = getopt(argc, argv, "FSO:l:s:d:Dp:h?Vaiof:")) )
switch (opt) {
+ case 'F':
+ Fork = False;
+ break;
+ case 'S':
+ log_stdout = True;
+ break;
case 'O':
pstrcpy(user_socket_options,optarg);
break;
@@ -554,6 +564,8 @@ static void process(void)
case 'i':
interactive = True;
+ Fork = False;
+ log_stdout = True;
break;
case 'D':
@@ -586,6 +598,11 @@ static void process(void)
usage(argv[0]);
exit(1);
}
+ if (log_stdout && Fork) {
+ d_printf("Can't log to stdout (-S) unless daemon is in foreground (-F) or interactive (-i)\n");
+ usage(argv[0]);
+ exit(1);
+ }
#ifdef HAVE_SETLUID
/* needed for SecureWare on SCO */
@@ -604,7 +621,7 @@ static void process(void)
set_remote_machine_name("wrepld");
- setup_logging(argv[0],interactive);
+ setup_logging(argv[0],log_stdout);
/* we want to re-seed early to prevent time delays causing
client problems at a later date. (tridge) */
@@ -682,7 +699,7 @@ static void process(void)
if (is_daemon && !interactive) {
DEBUG( 3, ( "Becoming a daemon.\n" ) );
- become_daemon();
+ become_daemon(Fork);
}
#if HAVE_SETPGID