exit 1
}
-# data dir from autoconf?
-DATA_DIR="@MAKE_DATA_DIR@"
-if test -z "$DATA_DIR" ; then
- DATA_DIR="/usr/local/citadel"
+DATA_DIR="/usr/local/citadel"
+
+
+
+usage() {
+ echo "Usage: database_cleanup.sh [ -h citadel_dir ]"
+ exit 2
+}
+
+PARSED_ARGUMENTS=$(getopt -a -n database_cleanup.sh -o h: -- "$@")
+VALID_ARGUMENTS=$?
+if [ "$VALID_ARGUMENTS" != "0" ]; then
+ usage
fi
+
+eval set -- "$PARSED_ARGUMENTS"
+while :
+do
+ case "$1" in
+ -h | --alpha)
+ DATA_DIR=${2}
+ shift 2
+ ;;
+ # -- means the end of the arguments; drop this, and break out of the while loop
+ --) shift; break ;;
+ # If invalid options were passed, then getopt should have reported an error,
+ # which we checked as VALID_ARGUMENTS when getopt was called...
+ *) echo "Unexpected option: $1 - this should not happen."
+ usage
+ ;;
+ esac
+done
+
DATA_DIR=$DATA_DIR/data
# If we're on an Easy Install system, use our own db_ tools.
!
+echo We will attempt to look for a Citadel database in $DATA_DIR
echo -n "Do you want to continue? "
read yesno
do
filename=cdb.$x
echo Dumping $filename
- $DUMP -h $DATA_DIR $filename >/tmp/CitaDump.$x || die
+ $DUMP -h $DATA_DIR $filename >/tmp/CitaDump.$x || {
+ echo error $?
+ die
+ }
rm -f $DATA_DIR/$filename
done
* very loose parser that scrapes both kinds of feeds and is not picky about
* the standards compliance of the source data.
*
- * Copyright (c) 2007-2020 by the citadel.org team
+ * Copyright (c) 2007-2021 by the citadel.org team
*
* This program is open source software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 3.
// This handler is called whenever an XML tag opens.
//
-void rss_start_element(void *data, const char *el, const char **attribute)
-{
+void rss_start_element(void *data, const char *el, const char **attribute) {
struct rssparser *r = (struct rssparser *)data;
int i;
+ if (server_shutting_down) return; // shunt the whole operation if we're exiting
+
if (
(!strcasecmp(el, "entry"))
|| (!strcasecmp(el, "item"))
// This handler is called whenever an XML tag closes.
//
-void rss_end_element(void *data, const char *el)
-{
+void rss_end_element(void *data, const char *el) {
struct rssparser *r = (struct rssparser *)data;
StrBuf *encoded_field;
+ if (server_shutting_down) return; // shunt the whole operation if we're exiting
+
if (StrLength(r->CData) > 0) { // strip leading/trailing whitespace from field
StrBufTrim(r->CData);
}
struct rssurl *r;
struct rssroom *rr;
- while (rsstodo != NULL) {
+ while ((rsstodo != NULL) && (!server_shutting_down)) {
rss_pull_one_feed(rsstodo);
r = rsstodo;
rsstodo = rsstodo->next;
char cfgline[SIZ];
int i = 0;
+ if (server_shutting_down) return;
+
serialized_config = LoadRoomNetConfigFile(qrbuf->QRnumber);
if (!serialized_config) {
return;
CtdlShutdownServiceHooks(); /* close all listener sockets to prevent new connections */
PerformSessionHooks(EVT_SHUTDOWN); /* run any registered shutdown hooks */
+ /* We used to wait for all threads to exit. Fuck that. The only thing important is that the databases are
+ * cleanly unmounted. After that, exit the whole program.
+ */
+#if 0
int countdown = 30;
while ( (num_workers > 0) && (countdown-- > 0)) {
syslog(LOG_DEBUG, "Waiting %d seconds for %d worker threads to exit",
);
usleep(1000000);
}
+#endif
+
}