So, it was that kind of day. Time to document a thing…

Screen Shot 2022 04 08 at 2.26.42 PM

To clear your php-fpm logs daily, set up a CRON job to run the following script. You will need to update the log file path and script path to work with your setup – I have multiple PHP versions installed on Mac via homebrew.

# daily clean php-fpm logs
# 0 0 * * * sh /Users/kevin/Dev/CRON/

if test -f "$LOGFILE"; then
    echo "$LOGFILE exists."
    echo "" > "$LOGFILE"
    echo "$LOGFILE contents:"
    tail "$LOGFILE"
    echo "$LOGFILE does not exist."

Now, add it to your Mac’s CRON with crontab -e.

0 0 * * * sh /Users/kevin/Dev/CRON/


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.