9394952

导航

crontab里的避坑指南

在定时任务里写个备份,按日期生成日志
0 9 * * * /home/oracle/dbbackup.sh >> /home/oracle/dbbackup_`date +i%Y%m%d`.log

 结果死活报错:

/bin/sh: -c: line 0: unexpected EOF while looking for matching ``'
/bin/sh: -c: line 1: syntax error: unexpected end of file

放狗结果:

https://superuser.com/questions/1095645/unexpected-eof-while-looking-for-matching-for-cron-job

改为这样,正常了

0 9 * * * /home/oracle/dbbackup.sh >> "/home/oracle/dbbackup_`date +\%Y\%m\%d`.log"



posted on 2023-05-10 10:58  9394952  阅读(27)  评论(0编辑  收藏  举报