Newsgroups: comp.unix.misc Path: utzoo!telly!eci386!jmm From: jmm@eci386.uucp (John Macdonald) Subject: Re: Protection from "rm *" Message-ID: <1990Oct18.152958.15635@eci386.uucp> Reply-To: jmm@eci386.UUCP (John Macdonald) Organization: Elegant Communications Inc. References: <1990Oct11.184004.9353@nntp-server.caltech.edu> <1100@bilver.UUCP> <4195@auspex.auspex.com> <4198@lib.tmc.edu> <1990Oct16.215634.23052@athena.mit.edu> Date: Thu, 18 Oct 90 15:29:58 GMT In article <1990Oct16.215634.23052@athena.mit.edu> jik@athena.mit.edu (Jonathan I. Kamens) writes: |In article <4198@lib.tmc.edu>, jmaynard@thesis1.hsch.utexas.edu (Jay Maynard) writes: ||> OK...I give up. Why is not being able to remove a program in use a botch? | | [... description of why ...] There is no reason not to be able |to delete a file which is an executable image currently in use. There *are* |reasons why you *should* be able to do so. [...] | | If I can't delete a running executable, I am left with two choices: (a) move |the file to a different name (e.g. "foo.old") and copy the new one into place, |or (b) copy the new binary on top of the old one. The former choice is less |than optimal because I have to remember to go back and delete the ".old" file |later (and who knows, somebody may keep it running it all night, or for |several days, or whatever!), and the second choice is less than optimal |because after the new binary is copied on top of the old one, people will get |swap errors when the kernel tries to swap in from the (nonexistent) old |executable image. If this is a frequently occurring activity, then there is a simple way of getting choice (a) to work correctly. Make a directory "old" in each bin directory. To destructively update foo, "mv foo old/rm$$", and then copy in the new version. Have a cron job that runs nightly that does "find /bin/old /usr/bin/old -type f -print | xargs rm -f". It will keep trying until it can actually do the job. In times of heavy program upgrades, the cron job could be tried hourly if the old versions are cluttering up the disk. Alternately, the script that does moves old stuff to the old directory could get fancy - remove if possible before moving to old, and try to clean out the old directory too in case something is now removable. -- Cure the common code... | John Macdonald ...Ban Basic - Christine Linge | jmm@eci386