]> code.citadel.org Git - citadel.git/commitdiff
* added deamonize code.
authorWilfried Göesgens <willi@citadel.org>
Tue, 21 Nov 2006 21:56:46 +0000 (21:56 +0000)
committerWilfried Göesgens <willi@citadel.org>
Tue, 21 Nov 2006 21:56:46 +0000 (21:56 +0000)
webcit/debian/citadel-webcit.substvars
webcit/webserver.c

index d0621723f8f6737968b2d650df1df17f1678eb54..5d46b7e8c7b02088b255b721d703bf2cc52ca411 100644 (file)
@@ -1,2 +1,2 @@
 misc:Depends=debconf (>= 0.5) | debconf-2.0
-shlibs:Depends=libc6 (>= 2.3.5-1), libssl0.9.8 (>= 0.9.8a-1), zlib1g (>= 1:1.2.1)
+shlibs:Depends=libc6 (>= 2.3.6-6), libssl0.9.8 (>= 0.9.8b-1), zlib1g (>= 1:1.2.1)
index 50a6dc1e5fc58b7b03d67c43035931bcd35e8f4c..f90e445c7ce4d12aef4662542004e2dc388b0c0b 100644 (file)
@@ -57,6 +57,8 @@ char *ctdlhost = DEFAULT_HOST; /**< our name */
 char *ctdlport = DEFAULT_PORT; /**< our Port */
 int setup_wizard = 0;          /**< should we run the setup wizard? \todo */
 char wizard_filename[PATH_MAX];/**< where's the setup wizard? */
+int running_as_daemon = 0;     /**< should we deamonize on startup? */
+
 
 /** 
  * \brief This is a generic function to set up a master socket for listening on
@@ -531,9 +533,9 @@ int main(int argc, char **argv)
 
        /** Parse command line */
 #ifdef HAVE_OPENSSL
-       while ((a = getopt(argc, argv, "h:i:p:t:x:cfs")) != EOF)
+       while ((a = getopt(argc, argv, "h:i:p:t:x:dcfs")) != EOF)
 #else
-       while ((a = getopt(argc, argv, "h:i:p:t:x:cf")) != EOF)
+       while ((a = getopt(argc, argv, "h:i:p:t:x:dcf")) != EOF)
 #endif
                switch (a) {
                case 'h':
@@ -548,6 +550,9 @@ int main(int argc, char **argv)
                        home_specified = 1;
                        home=1;
                        break;
+               case 'd':
+                       running_as_daemon = 1;
+                       break;
                case 'i':
                        safestrncpy(ip_addr, optarg, sizeof ip_addr);
                        break;
@@ -591,6 +596,7 @@ int main(int argc, char **argv)
                        fprintf(stderr, "usage: webserver "
                                "[-i ip_addr] [-p http_port] "
                                "[-t tracefile] [-c] [-f] "
+                               "[-d] "
 #ifdef HAVE_OPENSSL
                                "[-s] "
 #endif
@@ -603,6 +609,12 @@ int main(int argc, char **argv)
                if (++optind < argc)
                        ctdlport = argv[optind];
        }
+
+       /* daemonize, if we were asked to */
+       if (running_as_daemon) {
+               start_daemon(0);
+       }
+
        /** Tell 'em who's in da house */
        lprintf(1, SERVER "\n");
        lprintf(1, "Copyright (C) 1996-2006 by the Citadel development team.\n"