Instructions for creating Cron Jobs on Directadmin

In the process of system or website administration, automating periodic tasks such as data backup, sending notification emails or running maintenance scripts is necessary to ensure stability and performance. That is when Cron Jobs becomes a powerful tool.

Cron Jobs is a feature that allows you to set up automatic execution schedules for commands or scripts on servers using the Linux operating system. When combined with DirectAdmin– one of the most popular control panels today, you can completely create and manage Cron Jobs easily without having to operate via the command line.

In this article, ngolongtech.net will guide you step by step on how to set up and use Cron Jobs through the DirectAdmin interface, from time configuration to how to write execution commands, to help you optimize the system management process.

What is Cron Jobs?

Cron Jobs is a feature that allows setting up and executing automatic tasks according to a pre-set schedule on Linux or Unix operating systems. Through Cron Jobs, system administrators can automate a series of tasks such as:

  • Automatically backup data periodically

  • Send email notifications on schedule

  • Execute PHP, Shell… commands or scripts periodically

  • Run system maintenance tasks without manual intervention

Using Cron Jobs helps optimize operating processes , reduce risks due to manual operations and save significant time for the technical team.

Instructions for creating Cron Jobs on DirectAdmin

In the next part, LBK.VN will guide you how to create and manage Cron Jobs through the DirectAdmin administration interface – one of the most popular control panels today in the hosting field.

Step 1: Access DirectAdmin

Log in to the administration system via browser:

https://yourdomain.com:2222
 
Create cron job

Use your hosting account information to log in.

Read more:Server administration service by LBK.VN

Step 2: Go to Cron Jobs

At the main interface of DirectAdmin, access:

Advanced Features → Cron Jobs

Go to Cron Jobs

Here you can create new, edit or delete existing cron.

When you have access to Create cron job

Set up Cron Job run cycle

When creating a Cron Job in DirectAdmin, you will see the time configuration fields including:

  • Minute : minute (0 – 59)

  • Hour : hour (0 – 23)

  • Day : day of the month (1 – 31)

  • Month : month (1 – 12 or month name: January, February,…)

  • Weekday : day of the week (0 – 7, where Sunday is 0 or 7; can use names: Sunday, Monday,…)

These fields allow you to set the execution frequency of the cron job according to your specific needs.

Read more: Instructions for installing Gmail on Outlook using POP3

Cron Job Time Structure

# ┌───────────── minute (0 – 59)
# │ ┌────────── hour (0 – 23)
# │ │ ┌───────── day of the month (1 – 31)
# │ │ │ ┌────── month (1 – 12 or Jan, Feb, …)
# │ │ │ │ ┌──── day of the week (0 – 7, Sunday = 0 or 7)
# │ │ │ │ │
# * * * * command to execute

Example of Cron Job execution command

In the Command section , you need to clearly declare the command you want the system to execute. Some common examples:

php /home/techtenten/domains/luan2025.site/public_html/script.php

 

curl -s http://www.luan2025.site/cron.php > /dev/null
 
wget -O /dev/null http://www.luan2025.site/cron.php

Note: The parameter > /dev/nullhelps hide the output, avoiding unnecessary log storage.

Note when configuring

  • Make sure you have selected all the time fields (Minute, Hour, Day, Month, Weekday).

  • Avoid leaving any fields blank unless absolutely necessary to prevent errors during initialization.

  • Once you create a Cron Job, you can edit or delete it at any time.

This is the result of creating Cron Jobs, you can edit it if you want.

This is the result of creating Cron Jobs
 
To check if the cron job configuration you have set up is working, please access the terminal on the hosting side to check.
 
Below is the result of a cron job that ran

Frequently Asked Questions (FAQ)

Can cron job run PHP file?

Yes, just use the correct PHP CLI path and script.

How do I know if a cron job ran successfully?

Log or configure email notification from the system.

I want cron not to run duplicate if previous script is not finished?

Use lock file or check progress ( pspid) in shell script.

Sponsored Links: