d1472289c2
Systemd provides for "timers" which is replacing cron. This change implements timers as an option to any created service. Change-Id: I8fdca58fcb43726560521c7c25f7e57cfb61353b Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
26 lines
782 B
Django/Jinja
26 lines
782 B
Django/Jinja
# {{ ansible_managed }}
|
|
|
|
[Unit]
|
|
Description={{ item.service_name }} timer
|
|
|
|
[Timer]
|
|
{% if item.timer.options is defined %}
|
|
{% for key, values in item.timer.options.items() %}
|
|
{{ key }}={{ values }}
|
|
{% endfor %}
|
|
{% else %}
|
|
{% set OnCalendar = [] %}
|
|
{% set _ = OnCalendar.extend([item.timer.cron_minute | default('*')]) %}
|
|
{% set _ = OnCalendar.extend([item.timer.cron_hour | default('*')]) %}
|
|
{% set _ = OnCalendar.extend([item.timer.cron_day | default('*')]) %}
|
|
{% set _ = OnCalendar.extend([item.timer.cron_weekday | default('*')]) %}
|
|
{% set _ = OnCalendar.extend([item.timer.cron_month | default('*')]) %}
|
|
OnBootSec=30min
|
|
Unit={{ item.service_name }}.service
|
|
Persistent=true
|
|
OnCalendar={{ OnCalendar | join(' ') }}
|
|
{% endif %}
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|