Skip to content
Snippets Groups Projects
Commit 13b51059 authored by Nicolas KAROLAK's avatar Nicolas KAROLAK
Browse files

simplify service template syntax

parent 5045c8ad
No related branches found
No related tags found
No related merge requests found
...@@ -3,7 +3,12 @@ Description=backup-{{ item['name'] }} ...@@ -3,7 +3,12 @@ Description=backup-{{ item['name'] }}
[Service] [Service]
Type=oneshot Type=oneshot
ExecStart={{ mv_script_path }} --rsync-set-flags "{% if item['rsync_flags'] is defined %}{{ item['rsync_flags'] }}{% else %}{{ mv_rsync_flags }}{% endif %}" --strategy "{% if item['retention_strategy'] is defined %}{{ item['retention_strategy'] }}{% else %}{{ mv_retention_strategy }}{% endif %}" {% if item['src_host'] is defined and item['src_host'] %}{{ item['src_host'] }}:{% endif %}{% if item['src_dir'] is defined %}{{ item['src_dir'] }}{% else %}{{ mv_src_dir }}{% endif %} {% if item['dest_host'] is defined and item['dest_host'] %}{{ item['dest_host'] }}:{% endif %}{% if item ['dest_dir'] is defined %}{{ item['dest_dir'] }}{% else %}{{ mv_base_dir }}/{{ item['name'] }}{% endif %} {{ mv_base_dir }}/{% if item['exclude_list_name'] is defined %}{{ item['exclude_list_name'] }}{% else %}{{ mv_exclude_list_name }}{% endif %}.txt ExecStart={{ mv_script_path }} \
--rsync-set-flags "{{ item['rsync_flags'] | d(mv_rsync_flags) }}" \
--strategy "{{ item['retention_strategy'] | d(mv_retention_strategy) }}" \
{% if item['src_host'] | d() %}{{ item['src_host'] }}:{% endif %}{{ item['src_dir'] | d(mv_src_dir) }} \
{% if item['dest_host'] | d() %}{{ item['dest_host'] }}:{% endif %}{{ item['dest_dir'] | d(mv_base_dir + '/' + item['name']) }} \
{{ mv_base_dir }}/{{ item['exclude_list_name'] | d(mv_exclude_list_name) }}.txt
{% if mv_mailer_enabled %} {% if mv_mailer_enabled %}
OnFailure={{ mv_mailer_service_name }}@%n.service OnFailure={{ mv_mailer_service_name }}@%n.service
{% endif %} {% endif %}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
Description=backup-{{ item['name'] }}-timer Description=backup-{{ item['name'] }}-timer
[Timer] [Timer]
OnCalendar={% if item['timer_calendar'] is defined %}{{ item['timer_calendar'] }}{% else %}{{mv_backup_timer_calendar }}{% endif %} OnCalendar={{ item['timer_calendar'] | d(mv_backup_timer_calendar) }}
[Install] [Install]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment