Guide to deleting all error_log files on cPanel WHM.

Hướng dẫn xóa tất cả file error_log trên cPanel WHM

The article provides commands for deleting error_log files in cPanel WHM. The command searches all /home/*/public_html directories for error_log files, with examples provided. It also shows how to sort results by file size and how to delete files larger than 50MB. Additionally, it explains how to set up a cron job to automatically delete error_log files daily. These commands may take a while to run depending on the number of files and accounts. Overall, the article offers a practical guide for managing error_log files in cPanel WHM.

How to Efficiently Manage error_log Files in cPanel WHM

Have you ever wondered how to quickly and effectively manage error_log files in your cPanel WHM account? Look no further, as we provide you with some handy commands and tips to streamline this process.

Finding all error_log files:
To locate all error_log files within your /home/*/public_html directories, including subdirectories, use the following command:

find /home/*/public_html -type f -name error_log -exec du -sh {} \;

Sorting error_log files by size:
If you wish to identify the error_log files that occupy the most space, you can sort the results using this command:

find /home/*/public_html -type f -name error_log -exec du -sh {} \; | sort -n

Filtering error_log files by size:
To list only the error_log files larger than 50MB, utilize the following command:

find /home/*/public_html -type f -name error_log -size +50000k -exec du -sh {} \;

Deleting error_log files:
To delete all created error_log files, simply run:

find /home/*/public_html -type f -iname error_log -delete

If you want to delete error_log files exceeding 50MB in size, execute:

find /home/*/public_html -type f -iname error_log -size +50000k -delete

Automating the deletion process:
For added convenience, you can set up a cron job to delete error_log files regularly. Use the crontab -e command to access the server jobs editor and add the following line to run the job daily at 02:30:

30 2 * * * find /home/*/public_html -type f -name error_log -delete

Once you’ve made the necessary changes, exit the crontab editor by pressing CTRL+X and confirm your modifications.

See also  Creating social sharing buttons for posts using Addtoany Share Buttons plugin.

By following these simple yet effective commands, you can efficiently manage error_log files in your cPanel WHM account without hassle. Start optimizing your file management process today!

5/5 - (3 votes)

Related posts