: Removing user files, but not mail folders?

: Removing user files, but not mail folders?

Post by Matthew Reis » Thu, 24 Nov 1994 16:43:55



I am a DNS/sendmail/general admin for several servers (4.1.3_U1).
I need to periodically cleanse the system of old user files.

Being a bit of a novice, I decided to use find as follows:
  find /home -atime +30 -size +20 -ok rm {} \;

I don't know how to avoid specific files (like shell startup files) using
find so I assumed such files would be smaller than 20 blocks and would
thus escape the find syntax above. (kludgy, I know).

Also, I'd really rather not incur user wrath by unceremoniously blowing
away mail folders (e.g. mbox). They use both /usr/ucb/mail and elm.  
Some are sly enough to rename a file 'mbox' to avoid an auto-wipe of
files of a "non-protected" name.

So:
 1. How to distinguish between files that are mail folders and other files?
 2. How to tell find: "Don't delete anybody's .login, .mailrc, etc.)?
 3. Am I barking up the wrong utility?
 4. How can I do this more elegantly?

T.I.A.
--
__________________________________________________________________________
Matthew R. Reiser

 
 
 

: Removing user files, but not mail folders?

Post by Seagu » Fri, 25 Nov 1994 03:43:56



Quote:

> I am a DNS/sendmail/general admin for several servers (4.1.3_U1).
> I need to periodically cleanse the system of old user files.

> Being a bit of a novice, I decided to use find as follows:
>   find /home -atime +30 -size +20 -ok rm {} \;

Yikes!

Quote:> I don't know how to avoid specific files (like shell startup files) using
> find so I assumed such files would be smaller than 20 blocks and would
> thus escape the find syntax above. (kludgy, I know).

Yikes! again.

Quote:> Also, I'd really rather not incur user wrath by unceremoniously blowing
> away mail folders (e.g. mbox). They use both /usr/ucb/mail and elm.  
> Some are sly enough to rename a file 'mbox' to avoid an auto-wipe of
> files of a "non-protected" name.

Yikes! for a third time.

[snip]

Quote:>  3. Am I barking up the wrong utility?

Worse: you're barking up the wrong philosophy.

Quote:>  4. How can I do this more elegantly?

By not doing it at all.  Your best bet, instead of arbitrarily wiping out
user files, is to enforce quotas to manage your disk space.  If you already
are doing this, then lower the users' quotas if you need the space.
Erasing files that meet certain criteria autmoatically, without the user's
permission, is a ticking time bomb-- only in /tmp should a sysadmin have
a right to periodically "clean" old files (remember: /tmp means never
having to say "I'm sorry").

Sooner or later, your find script is going to erase something important.
Just because a file hasn't been accessed in X days, that doesn't mean it's
junk, and you're going to have users screaming at you left and right.
And, it will be your fault.  Besides, how are you going to determine what
is and is not important?  Which dot files should be kept around?  Which
are really mail files, and which files are ones that people have added a
fake header to fool your script?  I could go on all day, and it would bore
you to tears, and at the end of it, you'd have a list of "rules" so
long that, even if they did work even 90% of the time, your system would
be so bogged down trying to clean the user files that it won't be usable.

Cheers,
-+JLS

--
                    "The best way out is always through."
                              --Robert Frost



 
 
 

: Removing user files, but not mail folders?

Post by Stephan Zielinsk » Fri, 25 Nov 1994 05:58:43



>I am a DNS/sendmail/general admin for several servers (4.1.3_U1).
>I need to periodically cleanse the system of old user files.

>Being a bit of a novice, I decided to use find as follows:
>  find /home -atime +30 -size +20 -ok rm {} \;

Massively bad idea.  Clobbering files at random just because they
haven't been accessed in a while will inspire your users to sieze
agricultural implements and torches and form a howling mob outside
your cube.  Users, bless their turgid little brains, always seem to
have irreplacable copies of their senior thesis lying around, or
drafts of their novels (some chapters of which haven't been revised in
over a month,) or GIFs of their cats...  Delete one of these, and your
telephone will explode from the sheer rage on the other end of the line.

A quick check on my home directory reveals that the line of code above
would delete ten percent of my files-- several of which are documents
I would fain not lose.

The path of widsom is simply to holler at people who are using too
much disk space.  Set up quotas if you must.

If you GOTTA delete old files, per some Byzantine policy inflicted
upon you by management, do not DELETE them-- move them to a different
partition and back them up onto tape.  TWICE, just in case the first
tape is eaten by a six-legged mutant killer sloth.

--

              Whip me.  Beat me.  Make me maintain AIX.

 
 
 

1. : Removing user files, but not mail folders?

I am a DNS/sendmail/general admin for several servers (4.1.3_U1).
I need to periodically cleanse the system of old user files.

Being a bit of a novice, I decided to use find as follows:
  find /home -atime +30 -size +20 -ok rm {} \;

I don't know how to avoid specific files (like shell startup files) using
find so I assumed such files would be smaller than 20 blocks and would
thus escape the find syntax above. (kludgy, I know).

Also, I'd really rather not incur user wrath by unceremoniously blowing
away mail folders (e.g. mbox). They use both /usr/ucb/mail and elm.  
Some are sly enough to rename a file 'mbox' to avoid an auto-wipe of
files of a "non-protected" name.

So:
 1. How to distinguish between files that are mail folders and other files?
 2. How to tell find: "Don't delete anybody's .login, .mailrc, etc.)?
 3. Am I barking up the wrong utility?
 4. How can I do this more elegantly?

T.I.A.
--
__________________________________________________________________________
Matthew R. Reiser

2. mirroring

3. removing duplicate mails in a mail folder

4. Makefile - Kernel dependancy ?

5. Removing duplicate mail messages from a folder

6. MenuButtonWidgets

7. mail folder is in /var/mail or /var/spool/mail

8. transport-level programming

9. Mails do not get removed from Mail Queue

10. Script to remove files and folders

11. What setting do I need for the /var/spool/mail/USER folders?

12. chmod of all the files and sub folders under one folder

13. rm folders, sub-folders and files older than one hour