File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

unix command

 
Jackie Wang
Ranch Hand
Posts: 315
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can anyone suggest what Unix commands i can use to maintain
a log file directory and prevent it from running out of disk space.

Are there any advantages and disadvantages of that?
 
Guy Allard
Ranch Hand
Posts: 776
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should read your man page for 'find', since usage varies across *nix flavors. In particular look at parameters ctime, mtime, and atime.

But something like:



To remove files older than 30 time units (days, maybe hours, see the man page).

Once you understand what the proper command is, you will probably want to schedule it via cron.

Guy
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17639
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For Linux and some other systems, perhaps even better would be the "logrotate" system. It does that plus other useful things related to logfiles.
 
krishna kanaga
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
cat opens readme.txt
grep gets the word "unix" in there
wc -l lists how many lines have the word "unix"

Basically, it tells you how many times "unix" was written. But, if unix is written twice on a line, it will count it once because of the -l parameter on wc.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Krishna, welcome to JavaRanch.

Please note that you are replying to a topic from 2006, three years ago. The original poster is probably not still waiting for an answer. Please don't wake the zombies.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic