我正在尝试在 ESXi 5.0 机器上通过 cron 运行 ghettoVCB。
这是命令(添加一些换行符以提高可读性)
/vmfs/volumes/VMs\ Pool/ghettoVCB-master/ghettoVCB.sh
-f /vmfs/volumes/4e5b4f96-ebf53b38-db36-bc305bd75982/ghettoVCB-master/vms_to_backup
-g /vmfs/volumes/4e5b4f96-ebf53b38-db36-bc305bd75982/ghettoVCB-master/ghettoVCB.conf
> /vmfs/volumes/4e5b4f96-ebf53b38-db36-bc305bd75982/ghettoVCB-master/ghettoVCB-backup-$(date +\%s).log
执行该命令确实做了它应该做的事情,但是当我将其添加到 crontab 时,syslog 输出以下内容:
2013-05-26T09:32:01Z crond[1481072]: failed user root parsing 1-7 /vmfs/volumes/VMs\ Pool/ghettoVCB-master/ghettoVCB.sh -f /vmfs/volumes/4e5b4f96-ebf53b38-db36-bc305bd75982/ghettoVCB-master/vms_to_backup -g /vmfs/volumes/4e5b4f96-ebf53b38-db36-bc305bd75982/ghettoVCB-master/ghettoVCB.conf > /vmfs/volumes/4e5b4f96-ebf53b38-db36-bc305bd75982/ghettoVCB-master/ghettoVCB-backup-$(date +\%s).log
以下是 crontab 的条目:
0 0 * * 1-7 /vmfs/volumes/VMs\ Pool/ghettoVCB-master/ghettoVCB.sh -f /vmfs/volumes/4e5b4f96-ebf53b38-db36-bc305bd75982/ghettoVCB-master/vms_to_backup -g /vmfs/volumes/4e5b4f96-ebf53b38-db36-bc305bd75982/ghettoVCB-master/ghettoVCB.conf > /vmfs/volumes/4e5b4f96-ebf53b38-db36-bc305bd75982/ghettoVCB-master/ghettoVCB-backup-$(date +\%s).log
有谁知道为什么 crond 无法解析命令?
答案1
拇指问题 - 简单答案:Cron-Count 从 0 开始 - 所以
0 0 * * 0-6
解决了问题