Added missing askbot cron jobs

Add new scheduled cron jobs, including send-email-alerts and
clean-session. Both cron jobs are executing a manage.py task
for an askbot site.

Change-Id: Idf6e378b37dc251d307c7c01d7c65ff8270fe89d
This commit is contained in:
Marton Kiss 2015-03-23 16:10:19 +01:00
parent 12e8b8a8a4
commit 6ec0ed81c8
3 changed files with 56 additions and 0 deletions

View File

@ -186,6 +186,14 @@ define askbot::site (
require => File[$askbot_site_root],
}
file { "${askbot_site_root}/cron":
ensure => directory,
owner => 'root',
group => 'root',
mode => '0755',
require => File[$askbot_site_root],
}
# askbot setup_templates
# copy template files from askbot's setup_templates into site config
$setup_templates = [ '__init__.py', 'manage.py', 'urls.py', 'django.wsgi']
@ -205,6 +213,48 @@ define askbot::site (
require => File["${askbot_site_root}/config"],
}
# cron jobs
file { "${askbot_site_root}/cron/send_email_alerts.sh":
ensure => present,
owner => 'root',
group => 'root',
mode => '0644',
content => template('askbot/cron/send_email_alerts.sh.erb'),
require => File["${askbot_site_root}/cron"],
}
file { "${askbot_site_root}/cron/clean_session.sh":
ensure => present,
owner => 'root',
group => 'root',
mode => '0644',
content => template('askbot/cron/clean_session.sh.erb'),
require => File["${askbot_site_root}/cron"],
}
# 0 3 * * *
cron { "${slot_name}-send-email-alerts":
name => "${slot_name}-send-mail-alerts.cron",
command => "/bin/bash ${askbot_site_root}/cron/send_email_alerts.sh",
user => root,
minute => '0',
hour => '3',
require => [
File["${askbot_site_root}/cron/send_email_alerts.sh"],
]
}
# 10 * * * *
cron { "${slot_name}-clean-session":
name => "${slot_name}-clean-session.cron",
command => "/bin/bash ${askbot_site_root}/cron/clean_session.sh",
user => root,
minute => '10',
require => [
File["${askbot_site_root}/cron/clean_session.sh"],
]
}
# post-configuration
Exec {
path => ['/bin', '/usr/bin', '/sbin', '/usr/sbin'],

View File

@ -0,0 +1,3 @@
#!/bin/bash
cd <%= @askbot_site_root %>/config
python manage.py clean_session

View File

@ -0,0 +1,3 @@
#!/bin/bash
cd <%= @askbot_site_root %>/config
python manage.py send_email_alerts