Skip to main content

Delete logs daily

Comments

2 comments

  • cPanelPeter cPanel Staff
    Hello, This information is available in the crontab man page (specifically the man 5 crontab page).
    Instead of the first five fields, one of eight special strings may appear: string meaning ------ ------- @reboot Run once, at startup. @yearly Run once a year, "0 0 1 1 *". @annually (same as @yearly) @monthly Run once a month, "0 0 1 * *". @weekly Run once a week, "0 0 * * 0". @daily Run once a day, "0 0 * * *". @midnight (same as @daily) @hourly Run once an hour, "0 * * * *".
    So you could enter the following from an ssh prompt:
    # crontab -e @daily rm -rf /usr/local/apache/logs/archive/* @daily rm -rf /var/log/nginx/*
    Out of curiosity, why do you want to do this? Log files are the first thing to examine by any system administrator if something goes wrong. If you remove all log files then you won't be able to determine the cause of a problem later if one comes up.
    0
  • JDPWebmaster
    Hello, This did the trick! Thank you!
    0

Please sign in to leave a comment.