标签:saltstack
SaltStack 之 计划任务批量修改[root@SlatStack-Master salt]# vi crontab.sls
crontab: #脚本脚识
cron.present: #模板:cron 计划任务 功能:present
- name: /usr/sbin/ntpdate times.aliyun.com >> /dev/null #需要追回的内容
- user: root #添加到root的计划列表
- minute: ‘*/5‘ #每五分钟执行一次上面的-name命令
[root@SlatStack-Master salt]# salt ‘Linux_Test‘ state.sls crontab
Linux_Test:
----------
ID: crontab
Function: cron.present
Name: /usr/sbin/ntpdate times.aliyun.com >> /dev/null
Result: True
Comment: Cron /usr/sbin/ntpdate times.aliyun.com >> /dev/null added to root‘s crontab
Started: 22:34:41.955076
Duration: 33.704 ms
Changes:
----------
root:
/usr/sbin/ntpdate times.aliyun.com >> /dev/null
Summary
------------
Succeeded: 1 (changed=1)
Failed: 0
------------
Total states run: 1
分钟:minute
时钟:hour
日期:daymonth
月:month
周:dayweek
[root@SlatStack-Master salt]# salt ‘Linux_Test‘ cmd.run ‘crontab -l‘
Linux_Test:
# Lines below here are managed by Salt, do not edit
*/5 * * * * /usr/sbin/ntpdate times.aliyun.com >> /dev/null
标签:saltstack
原文地址:http://blog.51cto.com/12965094/2126827