1.安装crontab软件包:
#yum install crontabs -y
2.新建备份脚本:
#vi /tmp/backup.sh,脚本内容如下:
d_bak="/tmp/ovirt_engine_backup/`date +%Y%m%d_%H%M%S`"
f_log="/tmp/rsync_ovirt_bak.txt"
[ -d ${d_bak} ] || mkdir -p ${d_bak}
cd ${d_bak}
engine-backup --mode=backup --file=ovirt-engine.bak --log=backup.log >${f_log} 2>&1
3.添加脚本执行权限:
#chmod 777 /tmp/backup.sh
4.添加定时任务:
vi /etc/crontab:
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# For details see man 4 crontabs
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
47 10 * * * root /tmp/backup.sh
5.启动定时任务服务:
#systemctl enable crond
#systemctl restart crond