Cron Job. How to setup a Cron Job?

What is Cron Job?

Cron in a Linux command runs any script or command automatically at time set by the job. For example if you want to run a PHP file once a week, month or every day etc then you can set a cron job to do this. Let say you want to take you database backup every day at 11PM, then you can write down your database backup script and run the file through Cron job automatically, Without running the file in you browser manually.

How to setup a Cron Job?

Different server provider provides different options to set the cron job. Some server does not have cron support so in those server you can't set up a Cron Job. And in some server it is very easy to set up a Cron job through control panel. EasyCron solves the problems for those servers which are not providing cron supports.

Set up a Cron Job In Godaddy Server

Godaddy Provides a Very easy process to set up a Cron job.
1. Login to your Account - Go to Web Hosting -Launch
2. Options & Setting - Tools - Cron Job Manager
3. Click on "Create Cron Job"
Godaddy Cron Setting

You can set an email address so you will get a mail when croj job executes.
Cron job title: You can give any name to identify the Cron job.
Frequency: Here you can set when you want to run the job.
Command: You can browse your file from the server that you want to run through Cron job.

You can also click on Custom button to get more setting options.

Set up a Cron Job In cPanel

1. Login to your account > Scroll down to "Advanced" section > Click on Cron job
Bluehost Cron Setting

2. Go to "Add New Cron Job" here you can set your cron command.
Bluehost Cron Setting

Common Settings: This will allows you to select a general time interval to run your file like hourly, twice a day, daily weekly etc.
Minute: Use this drop-down menu to select the number of minutes between running the cron job.
Hour: Use this drop-down menu to select the number of hours between running the cron job.
Day: Use this drop-down menu to select the number of days between running the cron job.
Month: Use this drop-down menu to select the number of months between running the cron job.
Weekday: Use this drop-down menu to select the day(s) of the week on which you wish to run the cron job.
Command: Here you can enter the path to your file.
example: lynx -source http://www.domain-name.com/path-to-your-file.php
or
You may set the path as: php -q /public_html/path-to-your-file.php

If your server doesn't support Cron then click here to solve the problem.

Comments
comments powered by Disqus