Linux在执行shell脚本时提示find: command not found,单独执行该命令可以正常执行
执行时提示一下命令./backup.sh:line45:date:commandnotfound//对应生成日子中显示日期./backup.sh:line47:find:...
执行时提示一下命令
./backup.sh: line 45: date: command not found //对应生成日子中显示日期
./backup.sh: line 47: find: command not found //对应删除备份
#!/bin/bash
#设置日志文件,提前建好log目录
LogFile=/home/oracle/bin/log/`date +"%Y-%m-%d"`.log
echo "backup start at $(date +"%Y-%m-%d %H:%M:%S")" >$LogFile
echo "backup end at $(date +"%Y-%m-%d %H:%M:%S")" >$LogFile
echo "start open ftp server at $(date +"%Y-%m-%d %H:%M:%S")" > $LogFile
echo "put ftp end at $(date +"%Y-%m-%d %H:%M:%S")" >$LogFile
#最后上传完毕后再查看本地备份大于7天的自动删除,这样就可以实现本地异地双备份
find /backup/datadmp -type f -mtime +8 -exec rm -f {} \;
exit 0
其中就第一个echo中能正常显示出时间来,其他的都提示date: command not found 展开
./backup.sh: line 45: date: command not found //对应生成日子中显示日期
./backup.sh: line 47: find: command not found //对应删除备份
#!/bin/bash
#设置日志文件,提前建好log目录
LogFile=/home/oracle/bin/log/`date +"%Y-%m-%d"`.log
echo "backup start at $(date +"%Y-%m-%d %H:%M:%S")" >$LogFile
echo "backup end at $(date +"%Y-%m-%d %H:%M:%S")" >$LogFile
echo "start open ftp server at $(date +"%Y-%m-%d %H:%M:%S")" > $LogFile
echo "put ftp end at $(date +"%Y-%m-%d %H:%M:%S")" >$LogFile
#最后上传完毕后再查看本地备份大于7天的自动删除,这样就可以实现本地异地双备份
find /backup/datadmp -type f -mtime +8 -exec rm -f {} \;
exit 0
其中就第一个echo中能正常显示出时间来,其他的都提示date: command not found 展开
6个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询