LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-27-2003, 02:21 AM   #1
tinaa
Member
 
Registered: Mar 2003
Posts: 58

Rep: Reputation: 15
cronolog


Hello All,

I have setup cronolog for creating logs in access.log.HHDDMMYYYY. which creates log file every hour. I want to write a script which will delete the log files which are older than 48 hrs ?

Could any one please put me on the correct path ?

Regards,

Last edited by tinaa; 06-27-2003 at 02:22 AM.
 
Old 06-27-2003, 04:08 AM   #2
soob
Member
 
Registered: May 2003
Location: A country town, Australia
Distribution: Debian
Posts: 72

Rep: Reputation: 15
Even without the special filenames... have a look at 'find'. if you change to the directory with those logfiles in it, try this: punctuation very important!

find . -ctime +2 exec ls -l {} \;

Actually that one just lists them so you can see if it's picked the right files. This should list files that were created more than 2 days ago but you may want to adjust it - see "man find". When it's listing the right files, replace "ls -l" with "rm -f".
 
Old 06-27-2003, 04:41 AM   #3
tinaa
Member
 
Registered: Mar 2003
Posts: 58

Original Poster
Rep: Reputation: 15
Hello and thanx for the reply,
When i execute this it says :
find . -ctime +2 exec ls -l {} \
>
find: paths must precede expression
Usage: find [path...] [expression]
 
Old 06-29-2003, 04:00 AM   #4
soob
Member
 
Registered: May 2003
Location: A country town, Australia
Distribution: Debian
Posts: 72

Rep: Reputation: 15
sorry, my bad. - in front of exec, and the ; MUST be on the end.

find . -ctime +2 -exec ls -l {} \;
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cronolog issues mgm36 Linux - Software 2 04-29-2005 11:06 AM
problems with cronolog current / previous cliffyman Linux - Software 0 05-16-2003 10:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration