• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

unix command

 
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 776
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Saloon Keeper
Posts: 28492
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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've read about this kind of thing at the checkout counter. That's where I met this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic