Commit | Line | Data |
---|---|---|
5058c3b5 | 1 | #!/bin/sh |
561223b1 | 2 | # cleanvolumes.sh 1.4 %G% |
5058c3b5 PC |
3 | # shell script to clean dumplog file |
4 | # | |
670f510f | 5 | PATH=:/etc/:/bin:/usr/bin: |
5058c3b5 | 6 | # Name of logfile |
670f510f | 7 | DL=/etc/dumplog |
5058c3b5 PC |
8 | # Name of tmp files |
9 | DT=/tmp/dumpclean$$ | |
10 | DE=/tmp/dumpedit$$ | |
02ba6f08 PC |
11 | export DT |
12 | export DE | |
5058c3b5 PC |
13 | trap "rm -f $DT $DE" 1 2 3 15 |
14 | sed -e 's/:.*$//' $DL | | |
15 | sort | | |
16 | uniq -c | | |
17 | awk '{ if ($1 != 1) | |
18 | { | |
19 | for (i = 0; i < $1-1; i++) | |
561223b1 | 20 | printf "$\n/%s/d\n", $2 |
5058c3b5 PC |
21 | } |
22 | }' > $DE | |
23 | if [ -s $DE ] | |
24 | then | |
25 | cp $DL $DT | |
26 | echo "w" >> $DE | |
27 | echo "q" >> $DE | |
28 | ed $DT < $DE > /dev/null | |
02ba6f08 | 29 | mv $DT $DL |
5058c3b5 | 30 | fi |
02ba6f08 | 31 | rm -f $DE |