Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- target=$1
- today=$(date +%F)
- for file in `ls $target`
- do
- FileSize=$(du -k $target"/"$file | cut -f1)
- if [ ${file: -4} == ".log" -a $FileSize -gt 5000 ]
- then
- newfile="${file}.old"
- mv $target"/"$file $target"/"$newfile
- touch $target"/"$file
- fi
- done
- cd $target
- tar -czvf "logs.old."$today".tar" *.old
- rm *.old
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement