编辑fansik_cron.sls文件:

内容如下:

cron_test:
  cron.present:
    - name: /bin/touch /tmp/fansik.txt
    - user: root
    - minute: '*'
    - hour: 20
    - daymonth: 1-27
    - month: '3,5'
    - dayweek: '*'

说明:*需要用单引号引起来,也可以使用file.managed模块来管理cron,因为系统的cron都是以配置文件的形式存在的;

           present:是增加任务计划;

           absent:是删除任务计划。

执行:salt '*' state.sls fansik_cron

加入top.sls使用高级状态执行:

标记top.sls文件,内容如下:

base:
  '*':
    - fansik_cron

执行:salt '*' state.highstate

 

相关文章:

  • 2021-06-17
  • 2022-01-13
  • 2021-06-01
  • 2022-03-07
  • 2021-11-18
猜你喜欢
  • 2022-12-23
  • 2021-12-21
  • 2021-11-18
  • 2021-05-24
相关资源
相似解决方案