Browse Source

Use cron job identifier to be able to update command

Change-Id: Id571945585863a08bd2317b57ecc6123a16e1857
pull/117/head
Filip Pytloun 7 years ago
parent
commit
912222253f
2 changed files with 10 additions and 0 deletions
  1. +4
    -0
      README.rst
  2. +6
    -0
      linux/system/job.sls

+ 4
- 0
README.rst View File

automatic_reboot_time: "02:00" automatic_reboot_time: "02:00"


Linux with cron jobs Linux with cron jobs
By default it will use name as an identifier, unless identifier key is
explicitly set or False (then it will use Salt's default behavior which is
identifier same as command resulting in not being able to change it)


.. code-block:: yaml .. code-block:: yaml


job: job:
cmd1: cmd1:
command: '/cmd/to/run' command: '/cmd/to/run'
identifier: cmd1
enabled: true enabled: true
user: 'root' user: 'root'
hour: 2 hour: 2

+ 6
- 0
linux/system/job.sls View File

{%- if job.enabled|default(True) %} {%- if job.enabled|default(True) %}
cron.present: cron.present:
- name: {{ job.command }} - name: {{ job.command }}
{%- if job.get('identifier', True) %}
- identifier: {{ job.get('identifier', job.get('name', name)) }}
{%- endif %}
- user: {{ job.user|default("root") }} - user: {{ job.user|default("root") }}
{%- if job.minute is defined %} {%- if job.minute is defined %}
- minute: '{{ job.minute }}' - minute: '{{ job.minute }}'
{%- else %} {%- else %}
cron.absent: cron.absent:
- name: {{ job.command }} - name: {{ job.command }}
{%- if job.get('identifier', True) %}
- identifier: {{ job.get('identifier', job.get('name', name)) }}
{%- endif %}
{%- endif %} {%- endif %}


{%- endfor %} {%- endfor %}

Loading…
Cancel
Save