|
|
linux系统中使用ansible 添加定时任务crontab& h. [, J8 m( E1 R" \
使用ansible 添加crontab定时任务:
$ ]4 R0 m+ p+ X) w. `9 a! r: k5 Eansible host -m shell -a 'echo "*/30 * * * * python /xx/xxx/xxx.py" |crontab'5 F$ f) b2 z) F
% a5 G( Y7 z" ?& r. Q2 H: R Z& {
ansible host -m shell -a 'crontab -l'
! J/ e. [( b/ x7 {* [6 g) w. w+ M) r" d4 C, s8 c
或者使用: ~, Q3 L$ C ]9 \& }4 j8 V
$ y3 C1 V; Q' Mansible host -m shell -a 'echo "*/30 * * * * python /xx/xxx/xxx.py" >>/var/spool/cron/user'# X; J8 }4 s6 ^8 _2 D3 U. C$ b
|
|