The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Daily log copy cron job

Discussion in 'General Discussion' started by browsing, May 16, 2004.

  1. browsing

    browsing Member

    Joined:
    Apr 4, 2004
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    I've been toying with cron jobs, and would like to grep the log file for the previous day's logs and create a gzipped file for each day.

    That can either be done by creating a cron job for each day - 365 days a year, or by a script referenced by a cron job running every day.

    I don't know how to make that script. But since this could be very useful for others with busy sites who'd like to download their logs in smaller increments, maybe someone would help out?

    Remember that we'd grep the log file for the PREVIOUS day's entries, not the current day.

    Anyone who'd tackle this?
     
  2. PWSowner

    PWSowner Well-Known Member

    Joined:
    Nov 10, 2001
    Messages:
    2,948
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    ON, Canada
  3. Ann

    Ann Member

    Joined:
    May 24, 2004
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    I already made some scripts to tackle this kind of job. And I'm planning a few more variations.

    Click on the smiley face to see the page with the scripts:

    :D
     
  4. rogcan

    rogcan Well-Known Member

    Joined:
    Jun 7, 2004
    Messages:
    48
    Likes Received:
    0
    Trophy Points:
    6
    Can anyone explain to me how to STOP my current cron job from creating a log file each time it's run ........

    It's accumilating and annoying.
     
  5. Ann

    Ann Member

    Joined:
    May 24, 2004
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Delete the cron job?
     
  6. rogcan

    rogcan Well-Known Member

    Joined:
    Jun 7, 2004
    Messages:
    48
    Likes Received:
    0
    Trophy Points:
    6
    They should make a new forum folder for ann called " I'm Female and not too bright "

    lol
     
  7. sawbuck

    sawbuck Well-Known Member

    Joined:
    Jan 18, 2004
    Messages:
    1,367
    Likes Received:
    5
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    Sexism isn't required around here.
     
  8. Ann

    Ann Member

    Joined:
    May 24, 2004
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
  9. rogcan

    rogcan Well-Known Member

    Joined:
    Jun 7, 2004
    Messages:
    48
    Likes Received:
    0
    Trophy Points:
    6
    the post above says log files
    its leaving them in my root folder near my Public_Html folder with filename.1 filename.2 etc...

    and its not sexism , it was sarcasm :)
    I'm sure Ann know's i was kidding

    Good to see the senior members coming out to help though edewing *cough
     
    #9 rogcan, Jun 17, 2004
    Last edited: Jun 17, 2004
  10. rogcan

    rogcan Well-Known Member

    Joined:
    Jun 7, 2004
    Messages:
    48
    Likes Received:
    0
    Trophy Points:
    6
    i run a cron job and it works fine but it keeps a log file of it everytime its run.....

    this is the cron job :

    wget 'http://mysite.com/utstats/logs.php?pass=rockin'

    what can i put in this cron command so it dont log a file each time it's run ??
    or is the wget the problem ?


    This is the email it spits back as well:

    --00:20:00-- http://mysite.com/utstats/logs.php?pass=rockin
    => `logs.php?pass=rockin'
    Resolving mysite.com... done.
    Connecting to mysite.com[xx.xxx.xx.xx]:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: unspecified [text/html]

    0K 624.02 KB/s

    00:20:00 (624.02 KB/s) - `logs.php?pass=rockin' saved [639]



    i dont know /dev/null commands so any help would be appreciated :)
     
    #10 rogcan, Jul 14, 2004
    Last edited: Jul 14, 2004
  11. SarcNBit

    SarcNBit Well-Known Member

    Joined:
    Oct 14, 2003
    Messages:
    1,010
    Likes Received:
    3
    Trophy Points:
    38
    That is not a cron job it is a shell command

    /dev/null is location it has no commands

    You can append '>> /dev/null 2>&1' (sans quotes) to the end of your cron job to redirect the standard output and standard errors to /dev/null

    You should take Ann's advice and do a little reading.
     
  12. rogcan

    rogcan Well-Known Member

    Joined:
    Jun 7, 2004
    Messages:
    48
    Likes Received:
    0
    Trophy Points:
    6
    i did read.... Doesnt give or solve anything in my situation

    If what im using is a shell job, then what should the cron job look like then is my only question ???


    I think the logging is in the php files of the parser .....

    I'll have to dig through the scripting of these php files and find it maybe.
     
  13. SarcNBit

    SarcNBit Well-Known Member

    Joined:
    Oct 14, 2003
    Messages:
    1,010
    Likes Received:
    3
    Trophy Points:
    38
    Are you trying to schedule that wget command?

    When and how often are you trying to run it?
     
Loading...

Share This Page