Created
April 15, 2009 21:06
-
-
Save allaryin/96019 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function logrotate { | |
FNAME=$1 | |
MAX=$2 | |
for IDX in `seq ${MAX} -1 1` | |
do | |
OLD=$(( $IDX - 1 )) | |
if [ -e "${FNAME}.${OLD}" ] | |
then | |
mv "${FNAME}.${OLD}" "${FNAME}.${IDX}" | |
fi | |
done | |
if [ -e "${FNAME}" ] | |
then | |
mv "${FNAME}" "${FNAME}.1" | |
touch "${FNAME}" | |
fi | |
} | |
cd /var/log | |
logrotate something.log 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment