笨鸟写了一个日志备份的脚本,出错了,请大侠们帮忙!
时间:2011-06-23
来源:互联网
脚本的内容是这样的:
test2:/kbstorage/telesaleslog#more telesales.log_del.sh
#/bin/ksh
find /kbstorage/telesaleslog -name telesales.log* -mtime +7 -exec rm {}\;
执行的权限
test2:/kbstorage/telesaleslog#ls -l telesales.log_del.sh
-rwxrwxr-x 1 root system 87 6月22 17时35 telesales.log_del.sh
任务计划
crontab -l
0 23 * * * /kbstorage/telesaleslog/telesales.log_del.sh
邮件发过来的错误如下
Your "cron" job executed on test2 on Wed Jun 22 23:00:00 BEIST 201
/kbstorage/telesaleslog/telesales.log_del.sh
produced the following output:
find: 0652-018 An expression term lacks a required parameter.
*****************************************************************
cron: The previous message is the standard output
and standard error of one of the cron commands.
我的本意是这样的:
机器每天都会生出这种格式的日志文件:telesales.log.年-月-日,而且没有定期删除,每次备份完以后都要手动删除,非常的麻烦,我想保留最新7天的日志,只需要每天备份前一天就行,自动删除7天前一天的日志,这样日志里面总是最新的7天日志。我是个菜鸟,希望各位大侠们帮助小弟解决问题,比较的急,谢谢了!
test2:/kbstorage/telesaleslog#more telesales.log_del.sh
#/bin/ksh
find /kbstorage/telesaleslog -name telesales.log* -mtime +7 -exec rm {}\;
执行的权限
test2:/kbstorage/telesaleslog#ls -l telesales.log_del.sh
-rwxrwxr-x 1 root system 87 6月22 17时35 telesales.log_del.sh
任务计划
crontab -l
0 23 * * * /kbstorage/telesaleslog/telesales.log_del.sh
邮件发过来的错误如下
Your "cron" job executed on test2 on Wed Jun 22 23:00:00 BEIST 201
/kbstorage/telesaleslog/telesales.log_del.sh
produced the following output:
find: 0652-018 An expression term lacks a required parameter.
*****************************************************************
cron: The previous message is the standard output
and standard error of one of the cron commands.
我的本意是这样的:
机器每天都会生出这种格式的日志文件:telesales.log.年-月-日,而且没有定期删除,每次备份完以后都要手动删除,非常的麻烦,我想保留最新7天的日志,只需要每天备份前一天就行,自动删除7天前一天的日志,这样日志里面总是最新的7天日志。我是个菜鸟,希望各位大侠们帮助小弟解决问题,比较的急,谢谢了!
作者: wenchy001 发布时间: 2011-06-23
你的shell单独执行过了吗?
没有{}\之间空格就会出0652-018错
没有{}\之间空格就会出0652-018错
作者: tianyue01 发布时间: 2011-06-23
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28