Added [-x log_level] to ctdlvisor, this gets passed to citserver and webcit
authorArt Cancro <ajc@citadel.org>
Fri, 27 Aug 2021 18:13:44 +0000 (14:13 -0400)
committerArt Cancro <ajc@citadel.org>
Fri, 27 Aug 2021 18:13:44 +0000 (14:13 -0400)
Dockerfile
ctdlvisor.c

index 77e00aa79f761757f5bb82a97c444e5dcf2de11a..edd87bc434c4b676728688680b32045416a11929 100644 (file)
@@ -23,12 +23,12 @@ RUN sh -c 'mkdir /tmp/db_build && \
        cd /tmp && \
        rm -fr /tmp/db_build'
 
-# Deploy "ctdlvisor", a small supervisor program which runs inside the container to wrangle the various services
-ADD ctdlvisor.c /tmp
-
 # Create our build directory
 RUN mkdir /tmp/ctdl_build
 
+# Deploy "ctdlvisor", a small supervisor program which runs inside the container to wrangle the various services
+ADD ctdlvisor.c /tmp
+
 # Burn the cache if the upstream repository has changed
 ADD "https://easyinstall.citadel.org/libcitadel-easyinstall.tar.gz" /tmp/ctdl_build
 ADD "https://easyinstall.citadel.org/citadel-easyinstall.tar.gz" /tmp/ctdl_build
index 64e6c04c441b63e0e4ce4c1b8670e2ccdc94cbf1..0fa7d7f7fdf3df7fce27ca5b412794d42200bbfd 100644 (file)
@@ -25,6 +25,7 @@ pid_t citserver_pid;
 pid_t webcit_pid;
 pid_t webcits_pid;
 int shutting_down = 0;
+char *logging_flag = "-x1";
 
 // Call this instead of exit() just for common diagnostics etc.
 void ctdlvisor_exit(int code) {
@@ -93,8 +94,8 @@ pid_t start_citadel() {
        pid_t pid = fork();
        if (pid == 0) {
                fprintf(stderr, "ctdlvisor: executing citserver\n");
-               detach_from_tty();
-               execlp("/usr/local/citadel/citserver", "citserver", "-x9", "-h", CTDL_DIR, NULL);
+               //detach_from_tty();
+               execlp("/usr/local/citadel/citserver", "citserver", logging_flag, "-h", CTDL_DIR, NULL);
                exit(errno);
        }
        else {
@@ -108,8 +109,8 @@ pid_t start_webcit() {
        pid_t pid = fork();
        if (pid == 0) {
                fprintf(stderr, "ctdlvisor: executing webcit (http)\n");
-               detach_from_tty();
-               execlp("/usr/local/webcit/webcit", "webcit", "-x9", "-p", "80", "uds", CTDL_DIR, NULL);
+               //detach_from_tty();
+               execlp("/usr/local/webcit/webcit", "webcit", logging_flag, "-p", "80", "uds", CTDL_DIR, NULL);
                exit(errno);
        }
        else {
@@ -123,8 +124,8 @@ pid_t start_webcits() {
        pid_t pid = fork();
        if (pid == 0) {
                fprintf(stderr, "ctdlvisor: executing webcit (https)\n");
-               detach_from_tty();
-               execlp("/usr/local/webcit/webcit", "webcit", "-x9", "-s", "-p", "443", "uds", CTDL_DIR, NULL);
+               //detach_from_tty();
+               execlp("/usr/local/webcit/webcit", "webcit", logging_flag, "-s", "-p", "443", "uds", CTDL_DIR, NULL);
                exit(errno);
        }
        else {
@@ -212,7 +213,7 @@ int main(int argc, char **argv) {
        symlink(CTDL_DIR "/keys", "/usr/local/webcit/keys");
 
        /* parse command-line arguments */
-       while ((a=getopt(argc, argv, "cmd")) != EOF) switch(a) {
+       while ((a=getopt(argc, argv, "cmdx:")) != EOF) switch(a) {
 
                // test this binary for compatibility and exit
                case 'c':
@@ -230,9 +231,15 @@ int main(int argc, char **argv) {
                        database_cleanup_mode = 1;
                        break;
 
+               // logging level
+               case 'x':
+                       logging_flag = malloc(50);
+                       snprintf(logging_flag, 50, "-x%d", atoi(optarg));
+                       break;
+
                // any other parameter makes it crash and burn
                default:
-                       fprintf(stderr, "usage\n");
+                       fprintf(stderr, "%s: usage: %s [-c] [-m] [-d] [-x log_level]\n");
                        exit(1);
        }