我创建了这个剧本来设置 crontab:
- name: Set PATH to crontab
cron:
name: PATH
env: yes
user: barman
job: /usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/var/lib/barman/.local/bin:/var/lib/barman/bin:/usr/pgsql-10/bin/
- name: Automatically run backup for App1
cron:
name: "Run Backup for App1"
minute: "0"
hour: "3"
user: barman
job: "barman cron && barman backup app1"
- name: Automatically run backup for App2
cron:
name: "Run Backup for App2"
minute: "0"
hour: "4"
user: barman
job: "barman cron && barman backup app2"
但我只在/etc/cron.d/barman
文件下找到了这个:
# m h dom mon dow user command
* * * * * barman [ -x /usr/bin/barman ] && /usr/bin/barman -q cron
似乎没有正确设置任务。