-1
我有一个目录中的日志文件列表,这些目录堆积了一年多的时间。我已经编写了下面的脚本来存档超过15天的日志文件。unix脚本超过15天的归档日志文件
脚本:
#!/bin/bash
files=($(find /opt/Informatica/9.5.1/server/infa_shared/SessLogs -type f -mtime +15))
file=SessLog_bkup_`date +"%y-%m-%d"`.tar.gz
Backup=/opt/Informatica/9.5.1/server/infa_shared/SessLogs/Backup
tar -zcf $file --remove-files "${files[@]}"
mv $file $Backup
但是,当我运行它抛出以下错误的脚本
错误:
./backuplogs.sh: line 5: /bin/tar: Argument list too long.
请告知,如果我米小姐在脚本荷兰国际集团的东西
感谢您的帮助 基兰
标准解决方案是['logrotate'](https://github.com/logrotate/logrotate) – hek2mgl