summaryrefslogtreecommitdiffstats
path: root/abs/mv-core/syslog-ng/log_care.sh
blob: 7ca87b9ebe0ae49f6f391a44f9f705de64476264 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash
. /etc/profile
DATE=`date +%Y`

echo "compressing"
find /var/log/$DATE* -mtime  +1 -exec gzip -9 {} \;
echo "deleteing"
find /var/log/$DATE*  -mtime +7  -exec rm -rf {} \;

hostname=`hostname`
DATE=`date +%Y-%m-%d`

  cd /var/log || exit 1
    while read symlink target; do
                [ -z $target ] && target=$symlink
                    ln -sf $DATE/$hostname/$symlink $symlink
                      done <<'EOF'
                      maillog mail
                      messages
EOF
ln -sf $DATE/myth_mtc.log myth_mtc.log