DEV Community

Cover image for Cron job on a server
popoola Temitope
popoola Temitope

Posted on

Cron job on a server

What is a cron job?
A cron job is use to execute a particular script (code) on a scheduled time repeatedly.

What is cron job is use for?
Email marketing
Delete file
to send newsletter

How to setup cron job on a server

Login to the dashboard
Locate cron job and click on it
Then fill the for under add cron job

Select your command settings
This where you select may be the script will be execute once per day, once per week ,etc
Then select the minute,hour,day, monthly and weekend in which the cron job will be execute.

minute 0-59 The exact minute that the command sequence executes
hour 0-23 The hour of the day that the command sequence executes
day 1-31 The day of the month that the command sequence executes
month 1-12 The day of the month that the command sequence executes
weekday 0-6 The day of the week that the command sequence executes (Sunday = 0, Monday = 1, Tuesday = 2, and so forth)
command special The complete sequence of commands to execute. The command string must conform to Bourne shell syntax. Commands, executables (such as scripts), or combinations are acceptable.

command


cd/home/user /public_html/admin; php -q auto.php
This command will open the folder admin on n the server,
Then php represent the format of the script 
Follow by -q and then the file you want to execute

Enter fullscreen mode Exit fullscreen mode

Top comments (0)