SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Jan 2001
    0 Post(s)
    0 Thread(s)

    Cron Job for cleaning log file

    Sorry I ask this question here, but this is the best board I know and the only one I get my questions answered fast.
    I want to create a Cron Job for cleaning my access log file for my apache web server. Because I have my new server and I haven't created a a Cron Job for delete the log file and is getting quite big. Right now is over 1GB.
    I looked at the folder /var/log/httpd/ and found the following files named access_log:
    access_log - Size: 63MB
    access_log.1 - Size: 1186MB
    access_log.2 - Size: 710MB
    access_log.3 - Size: 301kb

    I want it to clear the log file every Sunday at midnight.

    Thanks for the help
    Last edited by pulsorocker; Jun 2, 2001 at 21:38.

  2. #2
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Sydney, Australia
    0 Post(s)
    0 Thread(s)
    hehehe - just a thought, if you want to completely purge the data in those log files, then you can just open them using fopen() with the write flag 'w' and close the file again. Opening with the 'w' flag will place the file pointer at the begining of the file and truncate it (ie, discard all its contents!).

    Most people seem to run their cron through php by setting them up to be read by lynx.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts