Revert "setup: reflect the fact that the operator should restart the server"
authorArt Cancro <ajc@citadel.org>
Thu, 31 Aug 2023 21:08:02 +0000 (12:08 -0900)
committerArt Cancro <ajc@citadel.org>
Thu, 31 Aug 2023 21:08:02 +0000 (12:08 -0900)
This reverts commit c7589e995080a55e55c587d65c85a5889beb4194.

citadel/utils/setup.c

index 28f44798ed14fbfe62cd68766ddaf4ec0df97d36..84d1d958ca8d94283160e5fca20d4f89e53c0985 100644 (file)
@@ -654,8 +654,9 @@ void unused_messages(void) {
                _("Setup is finished, but the Citadel server failed to start.\n"
                "Go back and check your configuration.\n")
        );
-       display_error(_("Restarting Citadel server to apply changes"));
-       display_error(_("Setup failed to restart Citadel server.  Please restart it manually."));
+       important_message(_("Setup finished"),
+               _("Setup is finished.  You may now start the server.")
+       );
 }
 
 
@@ -812,9 +813,52 @@ int main(int argc, char *argv[]) {
 
        check_xinetd_entry();   // Check /etc/xinetd.d/telnet
 
-       important_message(_("Setup finished"),
-               _("Setup is finished.  You may now start the server.")
-       );
+       // Restart citserver
+       activity = _("Restarting Citadel server to apply changes");
+       progress(activity, 0, 51);
+
+       serv_puts("TIME");
+       serv_gets(buf);
+       long original_start_time = extract_long(&buf[4], 3);
+
+       progress(activity, 1, 51);
+       serv_puts("DOWN 1");
+       progress(activity, 2, 51);
+       serv_gets(buf);
+       if (buf[0] != '2') {
+               display_error("%s\n", buf);
+               exit(6);
+       }
+
+       close(serv_sock);
+       serv_sock = (-1);
+
+       for (i=3; i<=6; ++i) {                                  // wait for server to shut down
+               progress(activity, i, 51);
+               sleep(1);
+       }
+
+       for (i=7; ((i<=48) && (serv_sock < 0)) ; ++i) {         // wait for server to start up
+               progress(activity, i, 51);
+               serv_sock = uds_connectsock(file_citadel_admin_socket);
+               sleep(1);
+       }
+
+       progress(activity, 49, 51);
+       serv_gets(buf);
+
+       progress(activity, 50, 51);
+       serv_puts("TIME");
+       serv_gets(buf);
+       long new_start_time = extract_long(&buf[4], 3);
+
+       close(serv_sock);
+       progress(activity, 51, 51);
+
+       if ((original_start_time == new_start_time) || (new_start_time <= 0)) {
+               display_error("%s\n", _("Setup failed to restart Citadel server.  Please restart it manually."));
+               exit(7);
+       }
 
        exit(0);
        return 0;