+ Reply to Thread
Results 1 to 2 of 2

Thread: Cron Job to Copy Log Files

  1. #1
    Junior Member
    Join Date
    Nov 2005
    Location
    UK
    Posts
    7

    Default Cron Job to Copy Log Files

    I want to setup a Cron job to copy my log files, as log files are only kept for 7 days. Can anyone help me with a unix command that might work please? I can see where to enter the Cron job in the control panel, but what command might I use?

    I want to copy '/hsphere/local/home/ukpages/logs/withernsea-carnival.co.uk/*.gz' to '/hsphere/local/home/ukpages/admin.withernsea-carnival.co.uk/rawlogs/'

    But if I do that each week, the file names will be the same and will overwrite the old logs. Is there a way to change the filename or add them all to a single gz file perhaps using the date at a filename?

    Also, which time and day would be best to do the copy, to make sure the entire weeks log files are there waiting to be copied?

    Many thanks
    Colin Davis
    webmaster@ukpages.org
    Regards
    Colin Davis

    Email: webmaster@ukpages.org
    Web: http://www.ukpages.org/

  2. #2
    DirectAdmin Fan :)
    Join Date
    Nov 2006
    Posts
    51

    Default

    The only way to do this that I am aware of is to create a script that will rotate the log based on x days or x size and rename it. Then you would run that script via ssh.

+ Reply to Thread

Posting Permissions

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