banner 728x90

Create and manage CRON tasks

In Mobile Web Development 54 views
banner 728x90

Interval or planned task execution is used everywhere in IT, the most obvious case is transaction batching. For web developers like myself, the most obvious use case is performing CRON tasks for this blog, including polling for scheduled blog post publication and a variety of other tasks. I also use crontab on my local computer to update remote git archives before I go to work every morning so that I always work from the most recent code. Let's take a brief look at the use of crontab to create and manage CRON tasks!

To create, edit, or delete CRON tasks, use the crontab command. You can view and edit existing tasks and create new tasks with the following command:


The previous command will show you a screen with existing CRON tasks if they exist:

# Example
01 * * * * /path/to/

The format for task planning is:

# * * * * * /path/to/
(minute) (hour) (day of the month) (month of the year) (day of the week) (script)

I recommend to create one executable file for each task – it keeps complex logic outside of the [crunching editing interface and avoids reinstallation when editing in crontab.

You can also set your crontab jobs to run every . For example, you can specify that a task is performed every 30 minutes of the hour with:

# Runs on the 30th minute of every month
30 * * * * /path/to/

You can use the format * / to perform a CRON task with small intervals:

# Performs a task every 15 minutes
* / 10 * * * * /path/to/

# Performs a task every 2 hours
0 * / 2 * * * /path/to/

You can also select exact values ​​with commas & # 39; s:

# Perform task only on weekdays
* * * * mon, tue, wo, thu, fri /path/to/

Delete or delete a CRON task by simply removing the rule from the crontab interface. One of the beauties of crontab is that the whole is refreshed when tasks are updated.

The automatic execution of tasks based on time is an incredibly useful option. I had always seen CRON as a website option, but having local functionality is also incredibly useful.

banner 728x90
    Resetting of file changes with git
    Resetting of file changes with git
    There are many different philosophies when it
    DDoS protection by Incapsula (sponsored)
    DDoS protection by Incapsula (sponsored)
    DDoS security is an incredibly important protection
    Long e-mail discussions: Be Gone !!
    Long e-mail discussions: Be Gone !!
    We've all been working on those long
    Changes to permissions for AWS Mobile Hub
    Changes to permissions for AWS Mobile Hub
    Until recently, when you first created an

    Leave a reply "Create and manage CRON tasks"

    Must read×