8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 23:23:04 +01:00

Added switch "-daemon" to guardian.

Thios seems a good replacement of used since 2.0 fbmgr functionality.
This commit is contained in:
alexpeshkoff 2008-04-25 16:33:30 +00:00
parent 3da277879c
commit 81e856251c

View File

@ -93,6 +93,7 @@ int CLIB_ROUTINE main( int argc, char **argv)
**************************************/ **************************************/
USHORT option = FOREVER; /* holds FOREVER or ONETIME or IGNORE */ USHORT option = FOREVER; /* holds FOREVER or ONETIME or IGNORE */
bool done = true; bool done = true;
bool daemon = false;
const TEXT* prog_name = argv[0]; const TEXT* prog_name = argv[0];
const TEXT* pidfilename = 0; const TEXT* pidfilename = 0;
int guard_exit_code = 0; int guard_exit_code = 0;
@ -103,6 +104,9 @@ int CLIB_ROUTINE main( int argc, char **argv)
const TEXT* p = *argv++; const TEXT* p = *argv++;
if (*p++ == '-') if (*p++ == '-')
switch (UPPER(*p)) { switch (UPPER(*p)) {
case 'D':
daemon = true;
break;
case 'F': case 'F':
option = FOREVER; option = FOREVER;
break; break;
@ -117,8 +121,8 @@ int CLIB_ROUTINE main( int argc, char **argv)
break; break;
default: default:
fprintf(stderr, fprintf(stderr,
"Usage: %s [-signore | -onetime | -forever (default)] [-pidfile filename]\n", "Usage: %s [-signore | -onetime | -forever (default)] [-daemon] [-pidfile filename]\n",
prog_name); prog_name);
exit(-1); exit(-1);
break; break;
} }
@ -179,6 +183,9 @@ int CLIB_ROUTINE main( int argc, char **argv)
} }
// detach from controlling tty // detach from controlling tty
if (daemon && fork()) {
exit(0);
}
divorce_terminal(0); divorce_terminal(0);
time_t timer = 0; time_t timer = 0;