Setup: in case of citserver not up & running, sleep & retry 10 times.
authorWilfried Goesgens <dothebart@citadel.org>
Sun, 25 Mar 2012 10:56:48 +0000 (12:56 +0200)
committerWilfried Goesgens <dothebart@citadel.org>
Sun, 25 Mar 2012 10:56:48 +0000 (12:56 +0200)
citadel/utils/setup.c

index 84af53594dd06ef1cf2639c44767868573e774f1..b5775fa26bd95952cc0a0f63fadfe490f7fdc717 100644 (file)
@@ -1158,8 +1158,9 @@ int main(int argc, char *argv[])
        char buf[1024]; 
        char aaa[128];
        int info_only = 0;
-       int relh=0;
-       int home=0;
+       int relh = 0;
+       int home = 0;
+       int nRetries = 0;
        char relhome[PATH_MAX]="";
        char ctdldir[PATH_MAX]=CTDLDIR;
        struct passwd *pw;
@@ -1230,11 +1231,17 @@ int main(int argc, char *argv[])
        /*
         * Connect to the running Citadel server.
         */
-        serv_sock = uds_connectsock(file_citadel_admin_socket);
+       while ((serv_sock < 0) && (nRetries < 10)) {
+               serv_sock = uds_connectsock(file_citadel_admin_socket);
+               nRetries ++;
+               if (serv_sock < 0)
+                       sleep(1);
+       }
        if (serv_sock < 0) { 
                display_error(
-                       "%s\n", 
-                       _("Setup could not connect to a running Citadel server.")
+                       "%s: %s %s\n", 
+                       _("Setup could not connect to a running Citadel server."),
+                       strerror(errno), file_citadel_admin_socket
                );
                exit(1);
        }