mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 19:23:03 +01:00
Added switch "-daemon" to guardian.
Thios seems a good replacement of used since 2.0 fbmgr functionality.
This commit is contained in:
parent
3da277879c
commit
81e856251c
@ -93,6 +93,7 @@ int CLIB_ROUTINE main( int argc, char **argv)
|
||||
**************************************/
|
||||
USHORT option = FOREVER; /* holds FOREVER or ONETIME or IGNORE */
|
||||
bool done = true;
|
||||
bool daemon = false;
|
||||
const TEXT* prog_name = argv[0];
|
||||
const TEXT* pidfilename = 0;
|
||||
int guard_exit_code = 0;
|
||||
@ -103,6 +104,9 @@ int CLIB_ROUTINE main( int argc, char **argv)
|
||||
const TEXT* p = *argv++;
|
||||
if (*p++ == '-')
|
||||
switch (UPPER(*p)) {
|
||||
case 'D':
|
||||
daemon = true;
|
||||
break;
|
||||
case 'F':
|
||||
option = FOREVER;
|
||||
break;
|
||||
@ -117,8 +121,8 @@ int CLIB_ROUTINE main( int argc, char **argv)
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,
|
||||
"Usage: %s [-signore | -onetime | -forever (default)] [-pidfile filename]\n",
|
||||
prog_name);
|
||||
"Usage: %s [-signore | -onetime | -forever (default)] [-daemon] [-pidfile filename]\n",
|
||||
prog_name);
|
||||
exit(-1);
|
||||
break;
|
||||
}
|
||||
@ -179,6 +183,9 @@ int CLIB_ROUTINE main( int argc, char **argv)
|
||||
}
|
||||
|
||||
// detach from controlling tty
|
||||
if (daemon && fork()) {
|
||||
exit(0);
|
||||
}
|
||||
divorce_terminal(0);
|
||||
|
||||
time_t timer = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user