aboutsummaryrefslogtreecommitdiffstats
path: root/script
diff options
context:
space:
mode:
Diffstat (limited to 'script')
-rwxr-xr-xscript/alert-comment-on-request2
-rwxr-xr-xscript/alert-new-response-reminders2
-rwxr-xr-xscript/alert-not-clarified-request2
-rwxr-xr-xscript/alert-overdue-requests2
-rwxr-xr-xscript/alert-tracks8
-rwxr-xr-xscript/alert-tracks-daemon6
-rwxr-xr-xscript/check-recent-requests-sent2
-rwxr-xr-xscript/clear-caches2
-rwxr-xr-xscript/delete-old-things4
-rwxr-xr-xscript/fill-database-caches2
-rwxr-xr-x[-rw-r--r--]script/generate_pot.sh0
-rwxr-xr-xscript/load-exim-logs4
-rwxr-xr-xscript/rails-post-deploy5
-rwxr-xr-xscript/runner41
-rwxr-xr-xscript/stop-new-responses-on-old-requests2
-rwxr-xr-xscript/update-xapian-index2
16 files changed, 68 insertions, 18 deletions
diff --git a/script/alert-comment-on-request b/script/alert-comment-on-request
index 006ba15f6..bfca2663f 100755
--- a/script/alert-comment-on-request
+++ b/script/alert-comment-on-request
@@ -2,6 +2,6 @@
LOC=`dirname $0`
-$LOC/runner 'RequestMailer.alert_comment_on_request'
+"$LOC/runner" 'RequestMailer.alert_comment_on_request'
diff --git a/script/alert-new-response-reminders b/script/alert-new-response-reminders
index 89ea117ab..d52381750 100755
--- a/script/alert-new-response-reminders
+++ b/script/alert-new-response-reminders
@@ -2,6 +2,6 @@
LOC=`dirname $0`
-$LOC/runner 'RequestMailer.alert_new_response_reminders'
+"$LOC/runner" 'RequestMailer.alert_new_response_reminders'
diff --git a/script/alert-not-clarified-request b/script/alert-not-clarified-request
index ac6636dce..bfdbeaff5 100755
--- a/script/alert-not-clarified-request
+++ b/script/alert-not-clarified-request
@@ -2,6 +2,6 @@
LOC=`dirname $0`
-$LOC/runner 'RequestMailer.alert_not_clarified_request'
+"$LOC/runner" 'RequestMailer.alert_not_clarified_request'
diff --git a/script/alert-overdue-requests b/script/alert-overdue-requests
index e496c569a..f6549e5b6 100755
--- a/script/alert-overdue-requests
+++ b/script/alert-overdue-requests
@@ -2,6 +2,6 @@
LOC=`dirname $0`
-$LOC/runner 'RequestMailer.alert_overdue_requests()'
+"$LOC/runner" 'RequestMailer.alert_overdue_requests()'
diff --git a/script/alert-tracks b/script/alert-tracks
index 056a88078..117f7a406 100755
--- a/script/alert-tracks
+++ b/script/alert-tracks
@@ -2,6 +2,10 @@
LOC=`dirname $0`
-$LOC/runner 'TrackMailer.alert_tracks'
-
+if [ "$1" == "--loop" ]
+then
+ "$LOC/runner" 'TrackMailer.alert_tracks_loop'
+else
+ "$LOC/runner" 'TrackMailer.alert_tracks'
+fi
diff --git a/script/alert-tracks-daemon b/script/alert-tracks-daemon
new file mode 100755
index 000000000..9064eaa05
--- /dev/null
+++ b/script/alert-tracks-daemon
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+LOC=`dirname $0`
+
+"$LOC/runner" --daemon TrackMailer.alert_tracks_loop
+
diff --git a/script/check-recent-requests-sent b/script/check-recent-requests-sent
index 351ffaaed..df5baf10a 100755
--- a/script/check-recent-requests-sent
+++ b/script/check-recent-requests-sent
@@ -2,7 +2,7 @@
LOC=`dirname $0`
-$LOC/runner 'EximLog.check_recent_requests_have_been_sent'
+"$LOC/runner" 'EximLog.check_recent_requests_have_been_sent'
diff --git a/script/clear-caches b/script/clear-caches
index 63e9a979d..e9438f92d 100755
--- a/script/clear-caches
+++ b/script/clear-caches
@@ -4,7 +4,7 @@
LOC=`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\")"
+"$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\")"
# 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 18e802ec7..1d8cf645b 100755
--- a/script/delete-old-things
+++ b/script/delete-old-things
@@ -2,8 +2,8 @@
LOC=`dirname $0`
-$LOC/runner 'PostRedirect.delete_old_post_redirects()'
+"$LOC/runner" 'PostRedirect.delete_old_post_redirects()'
-$LOC/runner 'TrackThingsSentEmail.delete_old_track_things_sent_email()'
+"$LOC/runner" 'TrackThingsSentEmail.delete_old_track_things_sent_email()'
diff --git a/script/fill-database-caches b/script/fill-database-caches
index 306b22ff2..e6b525144 100755
--- a/script/fill-database-caches
+++ b/script/fill-database-caches
@@ -6,6 +6,6 @@
LOC=`dirname $0`
-$LOC/runner 'IncomingMessage.find_each() { |im| print im.id.to_s + " id: main body folded:" + im.get_main_body_text_folded.size.to_s + " attachment clipped:" + im.get_attachment_text_clipped.size.to_s + "\n" }'
+"$LOC/runner" 'IncomingMessage.find_each() { |im| print im.id.to_s + " id: 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/generate_pot.sh b/script/generate_pot.sh
index fc693f6c8..fc693f6c8 100644..100755
--- a/script/generate_pot.sh
+++ b/script/generate_pot.sh
diff --git a/script/load-exim-logs b/script/load-exim-logs
index 4c6c57b5a..7e7f37a35 100755
--- a/script/load-exim-logs
+++ b/script/load-exim-logs
@@ -5,7 +5,7 @@ LOC=`dirname $0`
# Specific file if specified
if [ x$1 != x ]
then
- $LOC/runner 'EximLog.load_file("'$1'")'
+ "$LOC/runner" 'EximLog.load_file("'$1'")'
exit
fi
@@ -14,7 +14,7 @@ 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'")'
+ "$LOC/runner" 'EximLog.load_file("'$X'")'
done
diff --git a/script/rails-post-deploy b/script/rails-post-deploy
index 164a698e4..1329d9973 100755
--- a/script/rails-post-deploy
+++ b/script/rails-post-deploy
@@ -75,6 +75,11 @@ else
echo "ENV['RAILS_ENV'] = 'development'" > config/rails_env.rb
fi
+if [ -n "$OPTION_THEME_URL" ]
+then
+ script/plugin install --force $OPTION_THEME_URL
+fi
+
# upgrade database
rake db:migrate #--trace
diff --git a/script/runner b/script/runner
index e5f52ff8e..5a5254c47 100755
--- a/script/runner
+++ b/script/runner
@@ -1,5 +1,40 @@
#!/usr/bin/ruby
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
-require 'commands/runner' \ No newline at end of file
+daemon_mode = !ARGV.empty? && ARGV[0] == "--daemon"
+
+script_dir = File.dirname(__FILE__)
+alaveteli_dir = File.join(script_dir, "..")
+
+Dir.chdir(alaveteli_dir) do
+ require File.join(alaveteli_dir, 'config', 'boot')
+ if daemon_mode
+ # Run in daemon mode.
+
+ # If the environment variable LOGFILE is present,
+ # redirect STDERR and STDOUT to that file.
+ if ENV.has_key? "LOGFILE"
+ STDERR.reopen(STDOUT.reopen(ENV["LOGFILE"], "a"))
+ STDOUT.sync=true
+ puts "Daemon starting at #{Time.new}"
+ end
+
+ # Load the runner in a subprocess
+ pid = fork do
+ require 'commands/runner'
+ exit 0
+ end
+
+ # If the environment variable PIDFILE is present,
+ # write the pid of the daemon process to that file.
+ if ENV.has_key? "PIDFILE"
+ File.open(ENV["PIDFILE"], 'w') do |fh|
+ fh.puts pid
+ end
+ end
+
+ Process.detach(pid)
+ else
+ # Not daemon mode
+ require 'commands/runner'
+ end
+end
diff --git a/script/stop-new-responses-on-old-requests b/script/stop-new-responses-on-old-requests
index ea1ff9e0f..77189cf0b 100755
--- a/script/stop-new-responses-on-old-requests
+++ b/script/stop-new-responses-on-old-requests
@@ -2,6 +2,6 @@
LOC=`dirname $0`
-$LOC/runner 'InfoRequest.stop_new_responses_on_old_requests()'
+"$LOC/runner" 'InfoRequest.stop_new_responses_on_old_requests()'
diff --git a/script/update-xapian-index b/script/update-xapian-index
index 7f38fee80..8d1fa7d0c 100755
--- a/script/update-xapian-index
+++ b/script/update-xapian-index
@@ -1,5 +1,5 @@
#!/bin/bash
cd `dirname $0`
-rake --silent xapian:update_index
+rake --silent xapian:update_index