Results 1 to 16 of 16
  1. #1
    Join Date
    Jul 2009
    Posts
    61

    Script to delete error_log files..

    Hi!

    I have two Linux dedicated servers in HostGator.
    I need someone to makes me a WHM or Cpanel scripts that once a week should search and delete ALL error_log files.
    Is that possible?
    I will pay throught Paypal to the person that makes this for me.

    Thanks!!!
    Francisco

  2. #2
    Join Date
    Jul 2009
    Location
    UK
    Posts
    1,312
    Just find the files you want to delete? Then write a bash script then use crontab to delete em.

    Ie:

    File: delete.sh

    rm -f /var/log/httpd/error_log
    rm -f blaablaablaa


    Then in your crontab.

    @weekly ./path/to/file/delete.sh

    ( probably want to chmod +x delete.sh )
    Live Chat Support Software for your Business website - IMsupporting.com

  3. #3
    Join Date
    Jul 2009
    Posts
    61
    Hi lynxus!

    But I want the the script search in all the sites hosted in my dedi server...
    (in the path: /home/)
    and delete ALL error_log files automatically.

    Thanks!
    Francisco

  4. #4
    I can assist you with your requirements, please PM me.
    █► AllWorldIT ~ ISP / Hosting Provider / Government / Carrier Solutions
    █► HostOnARope ~ 24/7 SupportShared HostingReseller HostingVPS Servers
    █► www.hostonarope.com | AllWorldIT Online Product Range | visit AllWorldIT.com
    █► Official Proxmox Partner ~ UK/USA/ZASupport & SLA's Available

  5. #5
    Laswa Technologies can assist you with this requirement. We are a leading server management company with a very good reputation across WHT. This can be done for a reasonable price. Kindly send in a mail to sales@laswatech.com to get this done.

  6. #6
    Join Date
    Aug 2011
    Location
    Warsaw, Poland
    Posts
    1
    The script is simple:

    find /home/ -type f -name error_log -delete


    Just put in root' crontab.

  7. #7
    Join Date
    Aug 2003
    Location
    Edinburgh/London
    Posts
    5,789
    Quote Originally Posted by fmosse View Post
    Hi lynxus!

    But I want the the script search in all the sites hosted in my dedi server...
    (in the path: /home/)
    and delete ALL error_log files automatically.

    Thanks!
    Francisco
    What error logs are being stored in the /home/ directory? Just php error logs or others? You would need to know this (and their naming convention) before any script could be written.
    miniVPS - UK Based Value and Premium VPS Servers!
    Xavvo.com Innovative Hosting for Innovative People!

  8. #8
    Join Date
    Aug 2008
    Location
    Right behind you.
    Posts
    410
    Quote Originally Posted by fmosse View Post
    Hi!

    I have two Linux dedicated servers in HostGator.
    I need someone to makes me a WHM or Cpanel scripts that once a week should search and delete ALL error_log files.
    Is that possible?
    I will pay throught Paypal to the person that makes this for me.

    Thanks!!!
    Francisco
    We can do this at just $5. Please do email us on sales@we3cares.com

  9. #9
    Join Date
    Jul 2009
    Posts
    61
    Quote Originally Posted by Erik Zbik View Post
    The script is simple:

    find /home/ -type f -name error_log -delete


    Just put in root' crontab.
    Hi Erik Zbik,
    How do I create that cronjob in the WHM panel?
    Yours,
    Francisco

  10. #10
    Join Date
    Jul 2009
    Posts
    61
    Quote Originally Posted by nkukard View Post
    I can assist you with your requirements, please PM me.

    Hi nkukard!
    I can´t find the PM option anywhere!
    What I need is a script that finds and searches ALL “error_log” files hosted in the websites inside 2 dedicated servers in HostGator. I have WHM installed, and I also have SSH Access.
    Can you do that or email me the details “step by step”? I will pay you through Paypal. Which would be the cost?

    Thanks!
    Francisco

  11. #11
    Join Date
    Aug 2011
    Location
    Warsaw, Poland
    Posts
    1
    Francisco,

    Just edit /etc/crontab and insert this code as the bottom line

    0 * * * * root find /home/ -type f -name error_log -delete


    And it will be executed at 0 minute hourly.

  12. #12
    Join Date
    Aug 2011
    Location
    Warsaw, Poland
    Posts
    1
    Francisco,
    Please PM me for instant help. I can help you with more WHM/Linux tasks as well.

  13. #13
    Join Date
    Jul 2009
    Posts
    61
    Quote Originally Posted by HR-Martin View Post
    What error logs are being stored in the /home/ directory? Just php error logs or others? You would need to know this (and their naming convention) before any script could be written.
    They are just "error_log" files that the server generates when there is a 404, 505, etc. error. They are generated inside the directory where the error occurrs. And in the WHM panel of the dedicated server there are no options to "SET OFF" this, or to limit the sizes of the "error_log" files... so they use A LOT of space on the server!
    Thanks!
    Francisco

  14. #14
    Join Date
    Aug 2011
    Location
    Warsaw, Poland
    Posts
    1
    Francisco,
    The most correct solution is
    1. Detect what lines are logged into error_log's and fix the problem
    2. Disable logging to error_log into /home/
    I can do this.
    Erik.

  15. #15
    Join Date
    Jun 2009
    Location
    Houston,Tx
    Posts
    46
    To eliminate all the error log is going to cause clients issues. Some may need to see some of it.

    Easiest solution would be to tell php NOT to log errors, set ERror reporting to none:
    error_reporting = ~E_ALL
    display_errors = Off
    display_startup_errors = Off
    log_errors = Off


    error_log is generated by php, so disabling would eliminate this problem all together.

    If you'd still like to provide the error_log, but only in small doses, use logrotate script, or write a bash command that looks for error_logs over a certain size, copies the last 10 lines(just an example) to a temp file, removes the old error_log, puts the temp in it's place, chown it, and you're done there.
    Greg Borbonus
    greg@ableadmins.com LinkedIn Profile
    skype: greg.borbonus
    832-699-0461

  16. #16
    Join Date
    Mar 2004
    Location
    Odessa, Ukraine
    Posts
    610
    If you have root access I can disable logs totally

Similar Threads

  1. Replies: 6
    Last Post: 06-23-2011, 04:46 PM
  2. php script question: Delete old files remotely via FTP
    By Matt Wiss in forum Programming Discussion
    Replies: 0
    Last Post: 02-23-2010, 05:02 PM
  3. Turn on error_log files
    By acctman in forum Hosting Security and Technology
    Replies: 4
    Last Post: 09-15-2009, 11:43 AM
  4. Delete files after a certain period script?
    By Doh004 in forum Programming Discussion
    Replies: 2
    Last Post: 01-07-2005, 12:31 AM
  5. PHP Script to delete old files
    By mainarea in forum Programming Discussion
    Replies: 11
    Last Post: 04-09-2003, 01:20 AM

Posting Permissions

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