1、安装crontab:

yum install crontabs -y

2、新建备份脚本

vi /tmp/data/ovirt/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、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
30 1 * * * root /tmp/data/ovirt/backup.sh  //每天凌晨1点半执行脚本

4、添加脚本执行权限

chmod 777 /tmp/data/ovirt/backup.sh

5、启动定时任务服务

service crond start

6、将定时服务加到自启动

chkconfig crond on