aboutsummaryrefslogtreecommitdiffstats
path: root/script
diff options
context:
space:
mode:
Diffstat (limited to 'script')
-rwxr-xr-xscript/handle-mail-replies.rb2
-rwxr-xr-xscript/mailin2
-rwxr-xr-xscript/request-creation-graph12
-rwxr-xr-xscript/site-specific-install.sh7
-rwxr-xr-xscript/switch-theme.rb4
-rwxr-xr-xscript/user-use-graph6
6 files changed, 17 insertions, 16 deletions
diff --git a/script/handle-mail-replies.rb b/script/handle-mail-replies.rb
index 29f618154..89c24809d 100755
--- a/script/handle-mail-replies.rb
+++ b/script/handle-mail-replies.rb
@@ -1,5 +1,5 @@
#!/usr/bin/env ruby
-# -*- coding: utf-8 -*-
+# -*- encoding : utf-8 -*-
# Handle email responses sent to us.
#
diff --git a/script/mailin b/script/mailin
index f6b7d1194..48e236cfe 100755
--- a/script/mailin
+++ b/script/mailin
@@ -23,7 +23,7 @@ then
SUBJ="Mail import error for $OPTION_DOMAIN"
BODY="There was an error code $ERROR_CODE returned by the RequestMailer.receive command in script/mailin. See attached for details. This might be quite serious, such as the database was down, or might be an email with corrupt headers that Rails is choking on. We returned the email with an exit code 75, which for Exim at least instructs the MTA to try again later. A well configured installation of this code will separately have had Exim make a backup copy of the email in a separate mailbox, just in case."
FROM="$OPTION_BLACKHOLE_PREFIX@$OPTION_INCOMING_EMAIL_DOMAIN"
- /usr/bin/mutt -e "set use_envelope_from" -e "set envelope_from_address=$FROM" -s "$SUBJ" -a "$OUTPUT" "$INPUT" -- "$OPTION_FORWARD_NONBOUNCE_RESPONSES_TO" <<<"$BODY"
+ /usr/bin/mutt -e "set use_envelope_from" -e "set envelope_from_address=$FROM" -s "$SUBJ" -a "$OUTPUT" "$INPUT" -- "$OPTION_EXCEPTION_NOTIFICATIONS_TO" <<<"$BODY"
# tell exim error was temporary, so try again later (no point bouncing message to authority)
rm -f "$INPUT" "$OUTPUT"
diff --git a/script/request-creation-graph b/script/request-creation-graph
index 7d347a7d2..9b91e44b9 100755
--- a/script/request-creation-graph
+++ b/script/request-creation-graph
@@ -17,11 +17,7 @@ cd `dirname $0`
cd ../
source commonlib/shlib/deployfns
-# TODO: this is nasty :)
-OPTION_FOI_DB_HOST=`grep "host:" config/database.yml | head --lines=1 | cut -d ":" -f 2`
-OPTION_FOI_DB_PORT=`grep "port:" config/database.yml | head --lines=1 | cut -d ":" -f 2`
-OPTION_FOI_DB_NAME=`grep "database:" config/database.yml | head --lines=1 | cut -d ":" -f 2`
-OPTION_FOI_DB_USER=`grep "username:" config/database.yml | head --lines=1 | cut -d ":" -f 2`
+read OPTION_FOI_DB_HOST OPTION_FOI_DB_PORT OPTION_FOI_DB_NAME OPTION_FOI_DB_USER <<<$(ruby -r yaml -e 'db = YAML::load(STDIN.read); pr = db["production"]; puts pr["host"], pr["port"], pr["database"], pr["username"]' < config/database.yml)
SOURCEA=/tmp/foi-creation-rate-graph-data-$RANDOM$RANDOM
SOURCEB=/tmp/foi-creation-rate-graph-data-$RANDOM$RANDOM
@@ -51,6 +47,12 @@ function grab_data {
# rather nastily, work out the cumulative heights in reverse, so can plot impulses on top of each other
grab_data "where (1 = 1)" $SOURCEA
+if [ ! -s $SOURCEA ] ; then
+ # No data yet, skip graphing
+ echo "warning: no data to graph, skipping task"
+ exit
+fi
+
grab_data "where described_state not in ('waiting_response')" $SOURCEB
grab_data "where described_state not in ('waiting_response', 'waiting_clarification')" $SOURCEC
grab_data "where described_state not in ('waiting_response', 'waiting_clarification', 'not_held')" $SOURCED
diff --git a/script/site-specific-install.sh b/script/site-specific-install.sh
index fba164213..9358103b2 100755
--- a/script/site-specific-install.sh
+++ b/script/site-specific-install.sh
@@ -180,6 +180,9 @@ postfix reload
install_website_packages
+# Give the unix user membership of the adm group so that they can read the mail log files
+usermod -a -G adm "$UNIX_USER"
+
# Make the PostgreSQL user a superuser to avoid the irritating error:
# PG::Error: ERROR: permission denied: "RI_ConstraintTrigger_16564" is a system trigger
# This is only needed for loading the sample data, so the superuser
@@ -208,14 +211,14 @@ echo $DONE_MSG
if [ ! "$DEVELOPMENT_INSTALL" = true ]; then
echo -n "Creating /etc/init.d/$SITE... "
- (su -l -c "cd '$REPOSITORY' && bundle exec rake config_files:convert_init_script DEPLOY_USER='$UNIX_USER' VHOST_DIR='$DIRECTORY' VCSPATH='$SITE' SITE='$SITE' SCRIPT_FILE=config/sysvinit-thin.ugly" "$UNIX_USER") > /etc/init.d/"$SITE"
+ (su -l -c "cd '$REPOSITORY' && bundle exec rake config_files:convert_init_script DEPLOY_USER='$UNIX_USER' VHOST_DIR='$DIRECTORY' VCSPATH='$SITE' SITE='$SITE' SCRIPT_FILE=config/sysvinit-thin.example" "$UNIX_USER") > /etc/init.d/"$SITE"
chgrp "$UNIX_USER" /etc/init.d/"$SITE"
chmod 754 /etc/init.d/"$SITE"
echo $DONE_MSG
fi
echo -n "Creating /etc/init.d/$SITE-alert-tracks... "
-(su -l -c "cd '$REPOSITORY' && bundle exec rake config_files:convert_init_script DEPLOY_USER='$UNIX_USER' VHOST_DIR='$DIRECTORY' SCRIPT_FILE=config/alert-tracks-debian.ugly" "$UNIX_USER") > /etc/init.d/"$SITE-alert-tracks"
+(su -l -c "cd '$REPOSITORY' && bundle exec rake config_files:convert_init_script DEPLOY_USER='$UNIX_USER' VHOST_DIR='$DIRECTORY' SCRIPT_FILE=config/alert-tracks-debian.example" "$UNIX_USER") > /etc/init.d/"$SITE-alert-tracks"
chgrp "$UNIX_USER" /etc/init.d/"$SITE-alert-tracks"
chmod 754 /etc/init.d/"$SITE-alert-tracks"
echo $DONE_MSG
diff --git a/script/switch-theme.rb b/script/switch-theme.rb
index 980853687..47b3991c1 100755
--- a/script/switch-theme.rb
+++ b/script/switch-theme.rb
@@ -1,5 +1,5 @@
#!/usr/bin/env ruby
-# -*- coding: utf-8 -*-
+# -*- encoding : utf-8 -*-
# A simple script to swap around your Alaveteli themes when you're
# hacking on Alaveteli. By default this assumes that you have an
@@ -129,5 +129,5 @@ STDERR.puts """Switched to #{requested_theme}!
You will need to:
1. restart any development server you have running.
2. run: bundle exec rake assets:clean
- 3. run: bundle exec rake assets:precompile
+ 3. run: bundle exec rake assets:precompile (if running in production mode)
"""
diff --git a/script/user-use-graph b/script/user-use-graph
index 00eeb36f8..aad471a4b 100755
--- a/script/user-use-graph
+++ b/script/user-use-graph
@@ -16,11 +16,7 @@ cd `dirname $0`
cd ../
source commonlib/shlib/deployfns
-# TODO: this is nasty :)
-OPTION_FOI_DB_HOST=`grep "host:" config/database.yml | head --lines=1 | cut -d ":" -f 2`
-OPTION_FOI_DB_PORT=`grep "port:" config/database.yml | head --lines=1 | cut -d ":" -f 2`
-OPTION_FOI_DB_NAME=`grep "database:" config/database.yml | head --lines=1 | cut -d ":" -f 2`
-OPTION_FOI_DB_USER=`grep "username:" config/database.yml | head --lines=1 | cut -d ":" -f 2`
+read OPTION_FOI_DB_HOST OPTION_FOI_DB_PORT OPTION_FOI_DB_NAME OPTION_FOI_DB_USER <<<$(ruby -r yaml -e 'db = YAML::load(STDIN.read); pr = db["production"]; puts pr["host"], pr["port"], pr["database"], pr["username"]' < config/database.yml)
SOURCEA=/tmp/foi-creation-rate-graph-data-$RANDOM$RANDOM
SOURCEB=/tmp/foi-creation-rate-graph-data-$RANDOM$RANDOM