-daemon option

svn path=/trunk/boinc/; revision=9239
This commit is contained in:
David Anderson 2006-01-16 04:09:03 +00:00
parent c2597fef86
commit 6e89135a0a
5 changed files with 28 additions and 1 deletions

View File

@ -440,3 +440,12 @@ Rom 15 Jan 2006
Rom 15 Jan 2006 (HEAD)
- Tag for 5.3.11 release, all platforms
boinc_core_release_5_3_11
David 15 Jan 2006
- core client: add "-daemon" option (uses daemon() system call
to detach from controlling terminal)
From Jan Gall
client/
cs_cmdline.C
main.C

View File

@ -52,6 +52,7 @@ static void print_options(char* prog) {
" -detach detach from console (Windows)\n"
" -dir <path> use given dir as BOINC home\n"
" -no_gui_rpc don't allow GUI RPC, don't make socket\n"
" -daemon run as daemon (Unix)\n"
,
prog
);

View File

@ -45,9 +45,9 @@ typedef void (CALLBACK* IdleTrackerTerm)();
#include <sys/types.h>
#include <sys/socket.h>
#endif
#include <syslog.h>
#include <unistd.h>
#include <csignal>
//#include "synch.h"
#endif
#ifdef __APPLE__
@ -498,6 +498,19 @@ int main(int argc, char** argv) {
break;
}
}
#elif defined linux
int i;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-daemon") == 0 || strcmp(argv[i], "--daemon") == 0) {
syslog(LOG_DAEMON, "Starting Boinc-Daemon, listening on port %d.", GUI_RPC_PORT);
// from <unistd.h>:
// Detach from the controlling terminal and run in the background as system daemon.
// Don't change working directory to root ("/"), but redirect
// standard input, standard output and standard error to /dev/null.
daemon(1, 0);
break;
}
}
#endif
boinc_cleanup_completed = false;

View File

@ -71,6 +71,9 @@ list_item("-detach",
list_item("-no_gui_rpc",
"Don't allow GUI RPCs."
);
list_item("-daemon",
"Run as daemon (detach from controlling terminal; Linux only)
);
list_end();
echo "
<h2>Environment variables</h2>

View File

@ -119,6 +119,7 @@ show_name("Glenn Dill");
show_name("James Drews");
show_name("Charlie Fenton");
show_name("John Flynn III");
show_name("Jan Gall");
show_name("Michael Gary");
show_name("Marco Gazzoni");
show_name("Gary Gibson");