|
|
linux系统中使用ansible 添加定时任务crontab9 ]+ w7 x7 Z4 P/ B
使用ansible 添加crontab定时任务:* h2 p8 l' q/ `" @* H% a
ansible host -m shell -a 'echo "*/30 * * * * python /xx/xxx/xxx.py" |crontab'# F9 U; c* M9 R k4 w$ }3 m) U3 k
3 B- j( i9 S2 N% b! m' zansible host -m shell -a 'crontab -l'
" A6 m9 U, q- X( @" y9 ^0 L( O% ^
或者使用:
$ s) T4 J: u/ s6 V
- H8 w" G" k5 [, Pansible host -m shell -a 'echo "*/30 * * * * python /xx/xxx/xxx.py" >>/var/spool/cron/user'8 e/ F- W$ L3 B Q" l, g( n! e
|
|