diff options
author | Lukc <lukc@upyum.com> | 2010-12-11 19:15:23 +0100 |
---|---|---|
committer | Lukc <lukc@upyum.com> | 2010-12-11 19:15:35 +0100 |
commit | 6d908a38e05b9d4135c65d23114a5874215b5bb8 (patch) | |
tree | b5e6da6d95b9a1235d82032b509b80483a886ff5 /sysklogd/rotatelog | |
download | base-6d908a38e05b9d4135c65d23114a5874215b5bb8.tar.gz base-6d908a38e05b9d4135c65d23114a5874215b5bb8.tar.bz2 base-6d908a38e05b9d4135c65d23114a5874215b5bb8.tar.xz base-6d908a38e05b9d4135c65d23114a5874215b5bb8.zip |
Engagement initial.
Diffstat (limited to 'sysklogd/rotatelog')
-rwxr-xr-x | sysklogd/rotatelog | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/sysklogd/rotatelog b/sysklogd/rotatelog new file mode 100755 index 0000000..7ecb623 --- /dev/null +++ b/sysklogd/rotatelog @@ -0,0 +1,27 @@ +#!/bin/sh +# +# /usr/sbin/rotatelog: rotate logfile +# + +if [ "$1" = "" ]; then + echo "usage : `basename $0` <logfile>" + exit 1 +fi + +if [ ! -f /var/log/$1 ]; then + echo "`basename $0`: /var/log/$1 not found" + exit 1 +fi + +[ -f /var/log/old/$1.9 ] && rm /var/log/old/$1.9 +[ -f /var/log/old/$1.8 ] && mv /var/log/old/$1.8 /var/log/old/$1.9 +[ -f /var/log/old/$1.7 ] && mv /var/log/old/$1.7 /var/log/old/$1.8 +[ -f /var/log/old/$1.6 ] && mv /var/log/old/$1.6 /var/log/old/$1.7 +[ -f /var/log/old/$1.5 ] && mv /var/log/old/$1.5 /var/log/old/$1.6 +[ -f /var/log/old/$1.4 ] && mv /var/log/old/$1.4 /var/log/old/$1.5 +[ -f /var/log/old/$1.3 ] && mv /var/log/old/$1.3 /var/log/old/$1.4 +[ -f /var/log/old/$1.2 ] && mv /var/log/old/$1.2 /var/log/old/$1.3 +[ -f /var/log/old/$1.1 ] && mv /var/log/old/$1.1 /var/log/old/$1.2 +[ -f /var/log/$1 ] && (cp /var/log/$1 /var/log/old/$1.1; echo -n "" > /var/log/$1) + +# End of file |