"start) echo -n \"Starting WebCit... \"\n"
" if $WEBCIT_DIR/webserver "
"-D/var/run/webcit.pid "
- "-t/dev/null "
"-p$HTTP_PORT $CTDL_HOSTNAME $CTDL_PORTNAME\n"
" then\n"
" echo \"ok\"\n"
fprintf(fp, " echo -n \"Starting WebCit SSL... \"\n"
" if $WEBCIT_DIR/webserver "
"-D/var/run/webcit-ssl.pid "
- "-t/dev/null "
"-s -p$HTTPS_PORT $CTDL_HOSTNAME $CTDL_PORTNAME\n"
" then\n"
" echo \"ok\"\n"
/*
* Start running as a daemon.
*/
-void start_daemon(int do_close_stdio, char *pid_file)
+void start_daemon(char *pid_file)
{
int status = 0;
pid_t child = 0;
setsid();
umask(0);
- if (do_close_stdio) {
- freopen("/dev/null", "r", stdin);
- freopen("/dev/null", "w", stdout);
- freopen("/dev/null", "w", stderr);
- }
+ freopen("/dev/null", "r", stdin);
+ freopen("/dev/null", "w", stdout);
+ freopen("/dev/null", "w", stderr);
+
do {
current_child = fork();
- signal(SIGTERM, graceful_shutdown);
if (current_child < 0) {
perror("fork");
}
else if (current_child == 0) {
+ signal(SIGTERM, graceful_shutdown);
return; /* continue starting citadel. */
}
else {
+ signal(SIGTERM, SIG_IGN);
waitpid(current_child, &status, 0);
}
/* daemonize, if we were asked to */
if (running_as_daemon) {
- start_daemon(0, pidfile);
+ start_daemon(pidfile);
}
/** Tell 'em who's in da house */