aboutsummaryrefslogtreecommitdiffstats
path: root/script
diff options
context:
space:
mode:
Diffstat (limited to 'script')
-rwxr-xr-xscript/alert-comment-on-request4
-rwxr-xr-xscript/alert-new-response-reminders4
-rwxr-xr-xscript/alert-not-clarified-request4
-rwxr-xr-xscript/alert-overdue-requests6
-rwxr-xr-xscript/alert-tracks-daemon4
-rw-r--r--script/cache-incoming-emails4
-rwxr-xr-xscript/check-recent-requests-sent4
-rwxr-xr-xscript/clear-caches4
-rwxr-xr-xscript/delete-old-things9
-rwxr-xr-xscript/load-exim-logs13
-rwxr-xr-xscript/runner2
-rwxr-xr-xscript/stop-new-responses-on-old-requests4
12 files changed, 28 insertions, 34 deletions
diff --git a/script/alert-comment-on-request b/script/alert-comment-on-request
index bfca2663f..74782aa13 100755
--- a/script/alert-comment-on-request
+++ b/script/alert-comment-on-request
@@ -1,7 +1,7 @@
#!/bin/bash
-LOC=`dirname $0`
+cd "`dirname "$0"`"
-"$LOC/runner" 'RequestMailer.alert_comment_on_request'
+bundle exec ./runner 'RequestMailer.alert_comment_on_request'
diff --git a/script/alert-new-response-reminders b/script/alert-new-response-reminders
index d52381750..59fa76df1 100755
--- a/script/alert-new-response-reminders
+++ b/script/alert-new-response-reminders
@@ -1,7 +1,7 @@
#!/bin/bash
-LOC=`dirname $0`
+cd "`dirname "$0"`"
-"$LOC/runner" 'RequestMailer.alert_new_response_reminders'
+bundle exec ./runner 'RequestMailer.alert_new_response_reminders'
diff --git a/script/alert-not-clarified-request b/script/alert-not-clarified-request
index bfdbeaff5..a38fbc70e 100755
--- a/script/alert-not-clarified-request
+++ b/script/alert-not-clarified-request
@@ -1,7 +1,7 @@
#!/bin/bash
-LOC=`dirname $0`
+cd "`dirname "$0"`"
-"$LOC/runner" 'RequestMailer.alert_not_clarified_request'
+bundle exec ./runner 'RequestMailer.alert_not_clarified_request'
diff --git a/script/alert-overdue-requests b/script/alert-overdue-requests
index f6549e5b6..46450f1f2 100755
--- a/script/alert-overdue-requests
+++ b/script/alert-overdue-requests
@@ -1,7 +1,5 @@
#!/bin/bash
-LOC=`dirname $0`
-
-"$LOC/runner" 'RequestMailer.alert_overdue_requests()'
-
+cd "`dirname "$0"`"
+bundle exec ./runner 'RequestMailer.alert_overdue_requests()'
diff --git a/script/alert-tracks-daemon b/script/alert-tracks-daemon
index 9064eaa05..43712ae68 100755
--- a/script/alert-tracks-daemon
+++ b/script/alert-tracks-daemon
@@ -1,6 +1,6 @@
#!/bin/sh
-LOC=`dirname $0`
+cd "`dirname "$0"`"
-"$LOC/runner" --daemon TrackMailer.alert_tracks_loop
+bundle exec ./runner --daemon TrackMailer.alert_tracks_loop
diff --git a/script/cache-incoming-emails b/script/cache-incoming-emails
index a84a713d6..0b3069bd7 100644
--- a/script/cache-incoming-emails
+++ b/script/cache-incoming-emails
@@ -4,6 +4,6 @@
# Will take a while to run! Can use after clear-caches to refresh the database
# level caches if you like.
-LOC=`dirname $0`
+cd "`dirname "$0"`"
-"$LOC/runner" 'IncomingMessage.find_each() { |im| print "info request " + im.info_request.id.to_s + ", incoming message " + im.id.to_s + ": " + im.extract_attachments!.count.to_s + " attachments extracted to " + im.foi_attachments[0].directory + "; main body folded: " + im.get_main_body_text_folded.size.to_s + " attachment clipped:" + im.get_attachment_text_clipped.size.to_s + "\n" }'
+bundle exec ./runner 'IncomingMessage.find_each() { |im| print "info request " + im.info_request.id.to_s + ", incoming message " + im.id.to_s + ": " + im.extract_attachments!.count.to_s + " attachments extracted to " + im.foi_attachments[0].directory + "; main body folded: " + im.get_main_body_text_folded.size.to_s + " attachment clipped:" + im.get_attachment_text_clipped.size.to_s + "\n" }'
diff --git a/script/check-recent-requests-sent b/script/check-recent-requests-sent
index df5baf10a..588c6b73a 100755
--- a/script/check-recent-requests-sent
+++ b/script/check-recent-requests-sent
@@ -1,8 +1,8 @@
#!/bin/bash
-LOC=`dirname $0`
+cd "`dirname "$0"`"
-"$LOC/runner" 'EximLog.check_recent_requests_have_been_sent'
+bundle exec ./runner 'EximLog.check_recent_requests_have_been_sent'
diff --git a/script/clear-caches b/script/clear-caches
index be1d3d017..43fec2811 100755
--- a/script/clear-caches
+++ b/script/clear-caches
@@ -2,9 +2,9 @@
# Clear the cache of attachment and body text.
-LOC=`dirname $0`
+cd "`dirname "$0"`"
-"$LOC/runner" "ActiveRecord::Base.connection.execute(\"update incoming_messages set cached_attachment_text_clipped = null, cached_main_body_text_unfolded = null, cached_main_body_text_folded = null, sent_at = null, subject = null, mail_from = null, mail_from_domain = null, valid_to_reply_to = null, last_parsed = null\")"
+bundle exec ./runner "ActiveRecord::Base.connection.execute(\"update incoming_messages set cached_attachment_text_clipped = null, cached_main_body_text_unfolded = null, cached_main_body_text_folded = null, sent_at = null, subject = null, mail_from = null, mail_from_domain = null, valid_to_reply_to = null, last_parsed = null\")"
# Remove page cache (do it in two stages so live site gets cache cleared faster)
rm -fr $LOC/../old-cache
diff --git a/script/delete-old-things b/script/delete-old-things
index 1d8cf645b..063d85e1f 100755
--- a/script/delete-old-things
+++ b/script/delete-old-things
@@ -1,9 +1,6 @@
#!/bin/bash
-LOC=`dirname $0`
-
-"$LOC/runner" 'PostRedirect.delete_old_post_redirects()'
-
-"$LOC/runner" 'TrackThingsSentEmail.delete_old_track_things_sent_email()'
-
+cd "`dirname "$0"`"
+bundle exec ./runner 'PostRedirect.delete_old_post_redirects()'
+bundle exec ./runner 'TrackThingsSentEmail.delete_old_track_things_sent_email()'
diff --git a/script/load-exim-logs b/script/load-exim-logs
index 7e7f37a35..5ca0c66f8 100755
--- a/script/load-exim-logs
+++ b/script/load-exim-logs
@@ -1,21 +1,20 @@
#!/bin/bash
-LOC=`dirname $0`
+LOC=`dirname "$0"`
# Specific file if specified
if [ x$1 != x ]
then
- "$LOC/runner" 'EximLog.load_file("'$1'")'
+ f=`abspath "$1"`
+ cd "$LOC"
+ bundle exec ./runner 'EximLog.load_file("'$f'")'
exit
fi
# Load in last three days worth of logs (if they've been modified)
+cd "$LOC"
LATEST=$( ls /var/log/exim4/exim-mainlog-* 2>/dev/null | sort | tail -3 )
for X in $LATEST
do
- # echo "doing $X"
- "$LOC/runner" 'EximLog.load_file("'$X'")'
+ bundle exec ./runner 'EximLog.load_file("'$X'")'
done
-
-
-
diff --git a/script/runner b/script/runner
index 6b0bc0a08..2bd5e9aa7 100755
--- a/script/runner
+++ b/script/runner
@@ -3,7 +3,7 @@
daemon_mode = !ARGV.empty? && ARGV[0] == "--daemon"
script_dir = File.dirname(__FILE__)
-alaveteli_dir = File.join(script_dir, "..")
+alaveteli_dir = File.expand_path(File.join(script_dir, ".."))
Dir.chdir(alaveteli_dir) do
require File.join(alaveteli_dir, 'config', 'boot')
diff --git a/script/stop-new-responses-on-old-requests b/script/stop-new-responses-on-old-requests
index 77189cf0b..1e325403e 100755
--- a/script/stop-new-responses-on-old-requests
+++ b/script/stop-new-responses-on-old-requests
@@ -1,7 +1,7 @@
#!/bin/bash
-LOC=`dirname $0`
+cd "`dirname "$0"`"
-"$LOC/runner" 'InfoRequest.stop_new_responses_on_old_requests()'
+bundle exec ./runner 'InfoRequest.stop_new_responses_on_old_requests()'