aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/crontab-example5
-rw-r--r--doc/CHANGES.md5
-rwxr-xr-xscript/compact-xapian-database3
3 files changed, 8 insertions, 5 deletions
diff --git a/config/crontab-example b/config/crontab-example
index 44e328e4e..f65555b11 100644
--- a/config/crontab-example
+++ b/config/crontab-example
@@ -21,6 +21,7 @@ MAILTO=!!(*= $mailto *)!!
31 * * * * root !!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/commonlib/bin/run-with-lockfile.sh -n !!(*= $vhost_dir *)!!/load-mail-server-logs.lock !!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/script/load-mail-server-logs || echo "stalled?"
# Once a day, early morning
+31 1 * * * !!(*= $user *)!! !!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/commonlib/bin/run-with-lockfile.sh -n !!(*= $vhost_dir *)!!/change-xapian-database.lock "!!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/script/compact-xapian-database production !!(*= $site *)!!" || echo "stalled?"
23 4 * * * !!(*= $user *)!! !!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/commonlib/bin/run-with-lockfile.sh -n !!(*= $vhost_dir *)!!/delete-old-things.lock !!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/script/delete-old-things || echo "stalled?"
0 6 * * * !!(*= $user *)!! !!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/commonlib/bin/run-with-lockfile.sh -n !!(*= $vhost_dir *)!!/alert-overdue-requests.lock !!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/script/alert-overdue-requests || echo "stalled?"
0 7 * * * !!(*= $user *)!! !!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/commonlib/bin/run-with-lockfile.sh -n !!(*= $vhost_dir *)!!/alert-new-response-reminders.lock !!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/script/alert-new-response-reminders || echo "stalled?"
@@ -29,10 +30,6 @@ MAILTO=!!(*= $mailto *)!!
45 3 * * * !!(*= $user *)!! !!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/commonlib/bin/run-with-lockfile.sh -n !!(*= $vhost_dir *)!!/stop-new-responses-on-old-requests.lock !!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/script/stop-new-responses-on-old-requests || echo "stalled?"
55 4 * * * !!(*= $user *)!! !!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/commonlib/bin/run-with-lockfile.sh -n !!(*= $vhost_dir *)!!/update-public-body-stats.lock !!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/script/update-public-body-stats || echo "stalled?"
-# Only root can restart apache
-31 1 * * * root !!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/commonlib/bin/run-with-lockfile.sh -n !!(*= $vhost_dir *)!!/change-xapian-database.lock "!!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/script/compact-xapian-database production" || echo "stalled?"
-
-
# Once a day on all servers
43 2 * * * !!(*= $user *)!! !!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/script/request-creation-graph
48 2 * * * !!(*= $user *)!! !!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/script/user-use-graph
diff --git a/doc/CHANGES.md b/doc/CHANGES.md
index 40bab6ecf..ea8010d5f 100644
--- a/doc/CHANGES.md
+++ b/doc/CHANGES.md
@@ -39,6 +39,8 @@
now be translated (Louise Crow).
* Fixed a bug with the CSV import of authorities which have the same
name in multiple locales (Louise Crow).
+* No longer need to restart webserver when compacting Xapian database (Gareth
+ Rees).
## Upgrade notes
@@ -55,6 +57,9 @@
`app/views/request/select_authority.html.erb`,
`app/views/public_body/show.html.erb` and
`app/views/request/new.html.erb`.
+* [Regenerate your crontab](http://alaveteli.org/docs/installing/manual_install/#generate-crontab)
+ so that compacting the Xapian database only restarts the application, rather
+ than the webserver. This requires the [appropriate SysVinit script](http://alaveteli.org/docs/installing/manual_install/#generate-application-daemon) to be installed.
# Version 0.20
diff --git a/script/compact-xapian-database b/script/compact-xapian-database
index 075a71cd8..7d32d7a15 100755
--- a/script/compact-xapian-database
+++ b/script/compact-xapian-database
@@ -1,6 +1,7 @@
#!/bin/bash
export RAILS_ENV=$1
+if [ -z $2 ]; then DAEMON_NAME=alaveteli; else DAEMON_NAME=$2; fi
set -e
cd "$(dirname "$0")"/..
@@ -22,7 +23,7 @@ SU
mv "$XAPIAN_DB_DIR/$RAILS_ENV" "$XAPIAN_DB_DIR/$RAILS_ENV.tmp"
mv "$XAPIAN_DB_DIR/$RAILS_ENV.new" "$XAPIAN_DB_DIR/$RAILS_ENV"
rm -rf "$XAPIAN_DB_DIR/$RAILS_ENV.tmp"
- commonlib/bin/output-on-error /etc/init.d/apache2 restart
+ commonlib/bin/output-on-error service "$DAEMON_NAME" restart
fi
else
echo >&2 "Could not find xapian-compact script; have you installed xapian-tools?"