move cron jobs to common table and deploy apache log-based ban script
authorSarah Hoffmann <lonvia@denofr.de>
Fri, 12 Dec 2014 22:55:02 +0000 (23:55 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Fri, 12 Dec 2014 22:55:02 +0000 (23:55 +0100)
cookbooks/nominatim/recipes/default.rb
cookbooks/nominatim/templates/default/cron.erb [new file with mode: 0644]

index af96a9c771977cc6df90a8c4c7fe0ca342d621e5..d41e322a31f2710b68f967dc6c34bca3cd82d6be 100644 (file)
@@ -208,31 +208,15 @@ else
   cron_action = :delete
 end
 
-cron "nominatim_logrotate" do
+template "/etc/cron.d/nominatim" do
   action cron_action
-  hour "5"
-  minute "30"
-  weekday "0"
-  command "#{source_directory}/utils/cron_logrotate.sh"
-  user "nominatim"
-  mailto email_errors
+  source "cron.erb"
+  owner "root"
+  group "root"
+  mode "0644"
+  variables :bin_directory => "#{source_directory}/utils", :mailto => email_errors
 end
 
-cron "nominatim_banip" do
-  action cron_action
-  command "#{source_directory}/utils/cron_banip.py"
-  user "nominatim"
-  mailto email_errors
-end
-
-cron "nominatim_vacuum" do
-  action cron_action
-  hour "2"
-  minute "00"
-  command "#{source_directory}/utils/cron_vacuum.sh"
-  user "nominatim"
-  mailto email_errors
-end
 
 template "#{source_directory}/utils/nominatim-update" do
   source "updater.erb"
@@ -276,12 +260,3 @@ template "/usr/local/bin/backup-nominatim" do
   mode 0755
 end
 
-cron "nominatim_backup" do
-  action cron_action
-  hour "3"
-  minute "00"
-  day "1"
-  command "/usr/local/bin/backup-nominatim"
-  user "nominatim"
-  mailto email_errors
-end
diff --git a/cookbooks/nominatim/templates/default/cron.erb b/cookbooks/nominatim/templates/default/cron.erb
new file mode 100644 (file)
index 0000000..1ccb365
--- /dev/null
@@ -0,0 +1,9 @@
+# Maintained by chef. DO NOT EDIT.
+
+MAILTO=<%= @mailto %>
+
+30 5 * * 0 nominatim <%= @bin_directory %>/cron_logrotate.sh
+* * * * * lonvia <%= @bin_directory %>/cron_ipanalyse.py /var/log/apache2/nominatim.openstreetmap.org-access.log
+00 2 * * * nominatim <%= @bin_directory %>/cron_vacuum.sh
+00 3 1 * * nominatim /usr/local/bin/backup-nominatim
+