dump_heap();
#endif
+ /* If the operator requested a halt but not an exit, halt here. */
+ if (shutdown_and_halt) {
+ lprintf(CTDL_NOTICE, "citserver: Halting server without exiting.\n");
+ fflush(stdout); fflush(stderr);
+ while(1) {
+ sleep(32767);
+ }
+ }
+
/* Now go away. */
lprintf(CTDL_NOTICE, "citserver: Exiting with status %d\n", exitcode);
fflush(stdout); fflush(stderr);
time_to_die = 1;
}
+/*
+ * Halt the server without exiting the server process.
+ */
+void cmd_halt(void) {
+
+ if (CtdlAccessCheck(ac_aide)) return;
+
+ cprintf("%d Halting server. Goodbye.\n", CIT_OK);
+ time_to_die = 1;
+ shutdown_and_halt = 1;
+}
+
/*
* Schedule or cancel a server shutdown
*/
cmd_down();
}
+ else if (!strncasecmp(cmdbuf,"HALT",4)) {
+ cmd_halt();
+ }
+
else if (!strncasecmp(cmdbuf,"SCDN",4)) {
cmd_scdn(&cmdbuf[5]);
}
"specify a directory other than the default, you will need to\n"
"specify the -h flag to the server when you start it up.\n",
#else
-"Enter the subdirectoryname for an alternating installation of "
+"Enter the subdirectory name for an alternate installation of "
"Citadel. To do a default installation just leave it blank."
"If you specify a directory other than the default, you will need to\n"
"specify the -h flag to the server when you start it up.\n"
FILE *fp;
int fd;
- if ((fd = creat(
-#ifndef HAVE_ETC_DIR
- "."
-#else
- ETC_DIR
-#endif
- "/citadel.config", S_IRUSR | S_IWUSR)) == -1) {
+ if ((fd = creat(file_citadel_config, S_IRUSR | S_IWUSR)) == -1) {
display_error("setup: cannot open citadel.config");
cleanup(1);
}
home=(setup_directory[1]!='\0');
relh=home&(setup_directory[1]!='/');
- if (!relh) safestrncpy(ctdl_home_directory, setup_directory,
- sizeof ctdl_home_directory);
- else
- safestrncpy(relhome, ctdl_home_directory,
- sizeof relhome);
+ if (!relh) {
+ safestrncpy(ctdl_home_directory, setup_directory, sizeof ctdl_home_directory);
+ }
+ else {
+ safestrncpy(relhome, ctdl_home_directory, sizeof relhome);
+ }
calc_dirs_n_files(relh, home, relhome, ctdldir);
enable_home=(relh|home);
- if ((home) && (chdir(setup_directory) != 0)) {
- important_message("Citadel Setup",
- "The directory you specified does not exist.");
- cleanup(errno);
+ if (home) {
+ if (chdir(setup_directory) == 0) {
+ strcpy(file_citadel_config, "./citadel.config");
+ }
+ else {
+ important_message("Citadel Setup",
+ "The directory you specified does not exist.");
+ cleanup(errno);
+ }
}
/* Determine our host name, in case we need to use it as a default */
of the flag.
+ HALT (HALT the server without shutting it down)
+
+ Identical to the DOWN command, except instead of exiting, the server process
+cleans up and then suspends indefinitely. This could potentially be useful for
+shutdown scripts that don't want init to automatically respawn another citserver
+process.
+
+
EMSG (Enter a system MeSsaGe)
This is the opposite of the MESG command - it allows the creation and editing