To forget cleaning up file based locks

ask on 2002-12-14T00:20:45

$ ls -l total 195024 drwxrws--- 2 jobs jobs 32711168 Dec 13 15:53 lock -rw-rw-r-- 1 jobs jobs 166871040 Dec 13 15:53 session.db

it's bad news when the directory itself is taking up 32MB.

$ ls -F lock | wc -l 511110

Oops. Where did that crontab go again?

- ask


But how do I get rid of it?

jplindstrom on 2002-12-15T18:22:41

I did that once a long time ago.

What's the best way to delete those files? I remember it took forever to delete them all.

/J

Re:But how do I get rid of it?

ask on 2003-01-04T04:23:09

I don't think there's a super fast way. Put

    find /path/ -type f -mtime +7 | xargs rm

or something like that into your nightly crontab to make it not go out of control. Or use a different filesystem, like MySQL.

  - ask

Re:But how do I get rid of it?

Dom2 on 2003-01-07T10:05:48

But directories don't shrink. So you'll still be left with a 32Mb directory. The best way to do this is mv lock lock.old && mkdir lock. Then you can delete the lock.old directory at your leisure.

Of course, this assumes you can get the system into a quiescent state... If not, your way is far superior. :-)

-Dom

Re:But how do I get rid of it?

ask on 2003-01-10T22:48:37

Ah, yes. I didn't think of the 32MB directory entry. If I really wanted to save every byte I'd the mv "foo foo.old" etc as you said.