cron.rst 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. .. _tutorial-cron-with-salt:
  2. Using cron with Salt
  3. ====================
  4. The Salt Minion can initiate its own :ref:`highstate <running-highstate>` using
  5. the ``salt-call`` command.
  6. .. code-block:: bash
  7. $ salt-call state.apply
  8. This will cause the minion to check in with the master and ensure it is in the
  9. correct "state".
  10. Use cron to initiate a highstate
  11. ================================
  12. If you would like the Salt Minion to regularly check in with the master you can
  13. use cron to run the ``salt-call`` command:
  14. .. code-block:: bash
  15. 0 0 * * * salt-call state.apply
  16. The above cron entry will run a :ref:`highstate <running-highstate>` every day
  17. at midnight.
  18. .. note::
  19. When executing Salt using cron, keep in mind that the default PATH for cron
  20. may not include the path for any scripts or commands used by Salt, and it
  21. may be necessary to set the PATH accordingly in the crontab:
  22. .. code-block:: text
  23. PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/opt/bin
  24. 0 0 * * * salt-call state.apply