Cron Job Tutorial: Crontab Scheduling Syntax and Script Example

Written By
Web Webster
Web Webster
Dec 8, 2010

“Crontabs is very useful when doing website maintenance. You can
use this feature for the following purposes:

“1. Deleting all files in a certain folder at regular intervals.
If you accept user-uploaded files, then eventually it will clog
your web hosting server. If you do not regularly delete these
files, they will consume a lot of disk space and can slow down your
website.

“2. Deleting files of a specific type at regular intervals. You
can also choose to delete files of a specific type, instead of
deleting all of the files in the folder. If you have PHP, HTML and
MP3 files together inside the folder, you can delete only the MP3
files.

“3. Regularly backing up your MySQL database. This is one of the
most important webmaster tasks. By using crontabs or the cron job
feature, you can create a PHP script that will back up a selected
MySQL database, and have it execute automatically executed at a
specific, regular interval (e.g monthly, yearly, etc).

“This tutorial will focus on creating a cron PHP script
application, then configuring your cron hosting feature to execute
these scripts automatically.”


Complete Story

Web Webster

Web Webster

Web Webster has more than 20 years of writing and editorial experience in the tech sector. He’s written and edited news, demand generation, user-focused, and thought leadership content for business software solutions, consumer tech, and Linux Today, he edits and writes for a portfolio of tech industry news and analysis websites including webopedia.com, and DatabaseJournal.com.

Linux Today Logo

LinuxToday is a trusted, contributor-driven news resource supporting all types of Linux users. Our thriving international community engages with us through social media and frequent content contributions aimed at solving problems ranging from personal computing to enterprise-level IT operations. LinuxToday serves as a home for a community that struggles to find comparable information elsewhere on the web.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.