[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Teach me, please!!!
Your problem is not caused by user's file so the script to remove
whatever under /home/* is overkilled and does not help.
If you don't have enough space under /var, your system die as it
won't boot.
You can remove all the /var/adm/messages.* as you don't need this kind
of past records.
And, you can also remove whatever under /var/log.
To know how /var used up your disk space, do the followings:
1. cd /var
2. du .
3. df
du (2) will tell how your system clogged up overtimes as you
a. left your mails under /var/mail/...
b. syslog messages under /var/log
c. system console messages log under /var/adm
d. Past login record under /var/adm etc
(3)df will tell how you partition the disk to load SUN Os or Solaris
as a poor partition will not give you a lot of rooms to play.
You also want to do this
5. cd /
6. ls -la
to see whether they used the symbolic link to link /var/tmp to /usr/var/tmp or
so.
If you post the listing of the output of (2) and (3) then I can tell
how you utilize your system and what to delete.
When you run out of the system space under /var, you will not be able
to login or even boot.
For other places, it might hinder you to bring up the editor like vi.
The professional system administrator normally truncate message files
under /var/adm and move the old ones to the tape as well as /var/adm/wtmp
=============================================
------------------------------------------------------------
At 07:53 PM 3/4/97 -0600, you wrote:
>Vu Thanh Ca wrote:
>>
>> Ca'm o+n hai ba'c Paul Pham va` DDa`m So+n. Tuy nhie^n, to^i dda~
>> du`ng le^.nh df ma` kie^?m tra, ddi~a cu+'ng co`n i't nha^'t 100 MB.
>> Ma` cu~ng kho^ng muo^'n mua the^m ddi~a cu+'ng vi` ca'i ma'y na`y
>> dda~ bi. coi la` garbage ro^`i. To^i cho ra(`ng khi kho+?i ddo^.ng,
>> ma^'y ca'i file message do' se~ ddu+o+.c load le^n bo^. nho+'. Bo^.
>> nho+' la` 30 MB, ma` to^i chi? mo+'i xo'a co' 6MB tho^i, the^' ma` no'
>> dda~ to^'t ro^`i. Ba'c na`o bie^'t the^m thi` chi? cho to^i nhe'.
>>
>> Ca.
>ba'c ca,
>
>ca'i shell script na`y ne^n dda(.t te^n la` remove
> ba'c ta.o te^.p remove co' no^.i dung nhu+ sau :<>
> ca'i te^.p na`y la` cu?a user Local ba'c pha?i su+?a la.i no^.i dung
> cho phu` ho+.p vo+'i ba'c tho^i.
> ddo^?i quye^`n cha.y te^.p cho remove va` chi? co' ba'c ddu+o+.c
>ddo.c
> ca:> chmod 700 remove
> te^.p na`y ddu+o+.c thie^'t ke^' cho qua?n tri. ma.ng nho?
> va` ddang ch.ay tre^n ma'y RedHat, SunOS 4.1.3 va` SunSolaris 2.5.1
> ca:> remove
> no' se~ kho^ng la`m gi` vo+'i ca'c user co' thu+ mu.c la`
>Local/Mirror
> no' se~ email ke^'t qua? cho user operator qua le^.nh mail
>
>du` sao thi` SysAdmin cu~ng la` co^ng vie^.c kho^ng de^~
>ne^'u ba'c thi'ch tui se~ gu+?i cho ba'c "hu+o+'ng da^~n ve^` SysAdmin"
>
>chu'c ba'c tha`nh co^ng
>
>
>#!/bin/sh
># script to remove those files which have not been accessed
># for two weeks and match the following
># 1) *~, *.rsl%
>#
># for one week
># 2) *.aux, *.dvi, *.log, *.dlog, *.toc, and #* except those in
>~/archive
># 3) ,* in /home/*/Mail
># 4) .raise_dump.*
># 5) ,*
>#
># daily removing of core files
># 6) core
># 7) .netscape-cache
># 8) /disks/x3/space/pstmp
>#
>#-------------------------------------------------------------------------
># Create 2.1997 by ppn@iist.unu.edu
>#-------------------------------------------------------------------------
>#
># determine log file
>wd=`date '+%a'`
>ts=`date +%y%m%d%H%M%S`
>f=/home/Local/removelogs/$ts
>g=$f
>touch $f
>if [ ! -w $f ] ; then
> f=/`date +%y%m%d%H%M%S`
> touch $f
> if [ ! -w $f ] ; then
> f=/etc/`date +%y%m%d%H%M%S`
> touch $f
> if [ ! -w $f ] ; then
> f=/dev/null
> fi
> fi
>fi
>if [ $f != $g ]; then
> echo removed log file is $f | /usr/ucb/mail operator
>fi
>
># make sure log file is empty
>echo removed log file `date` > $f
>
># For files generated by LaTeX
>cd /home
># two weekly removing
>for d in *; do
> if [ "$d" != "Mirror" -a "$d" != "Local" ]; then
> find /home/$d/. \( -name '*~' -o -name '*.rsl%' \) \
> -atime +14 -ls >> $f -exec rm {} \; -o \( -name archive
>-prune \)
> fi
>done
>
># Weekly removing
>cd /home
>for d in *; do
> if [ "$d" != "Mirror" -a "$d" != "Local" ]; then
> find /home/$d/. \( -name '*.aux' -o -name '*.dvi' -o -name
>'*.log' \
> -o -name '*.dlog' -o -name '*.toc' -o -name '#*' \
> -o -name '.raise_dump.*' \) \
> -atime +7 -ls >> $f -exec rm {} \; -o \( -name archive
>-prune \)
> fi
>done
>#
># daily removing files
>cd /home
>for d in *; do
> if [ "$d" != "Mirror" -a "$d" != "Local" ]; then
> find /home/$d/. \( -name core \) \
> -ls >> $f -exec rm {} \; -o \( -name archive -prune \)
> fi
>done
>
># For old mail messages: expiration time 7 days
>for i in /home/*/Mail; do
> find $i -name ',*' -atime +7 -ls >> $f -exec rm {} \;
>done
>
># Delete .netscape/cache
>for i in /home/*/.netscape/cache/*; do
> #find $i -name '*' -ls >> $f -exec rm {} \;
> echo $i >> $f
> rm -r $i
>done
>
># dailly removing pstmp files
>for i in /disks/x3/space/pstmp/*; do
> echo $i >> $f
> rm -r $i
>done
>
># clean up log file references, delete old log files
>if [ $f = $g ]; then
> /etc/chown local $f
> oldlog=`ls -l /home/Local/removelogs/$wd | awk '{print $NF}'`
> rm -f /home/Local/removelogs/$wd /home/Local/removelogs/$oldlog
> (cd /home/Local/removelogs; ln -s $ts $wd)
> chmod 444 $f
>fi
>
># After removing finished, informing operator
>echo removing completed | /usr/ucb/mail operator
>
># End of file remove
>
>
-----------------------------------
Tuan Nguyen
t.a.nguyen@ieee.org
tuan@quicksoftinc.com
(408)262-8145