Creating Cron Jobs


#1

What is a Cron Job?

The purpose of a “Cron Job” is to schedule a time for a script to be run through an automated cURL request to your define URL. This scheduled task functionality is achieved, in our infrastructure, by offloading the task to a Cron Job server. This server is solely dedicated to running your automated tasks.

Note: These concepts can be applied to the Windows ASP/.NET & ColdFusion Hosting products. In the Windows ASP/.NET Hosting Product the Cron Jobs button is located in the “Reporting and Applications” category.

Adding A New Cron Job

To add a new cron job for your domain, please follow the steps below.

  1. Login to your WCP Control Panel

    Note: You can view our topic on logging into WCP if you need help with this step.


  2. Next, select the appropriate domain name from the “Hosted Domains” drop-down menu.

  3. Once the WCP control panel loads the desired domain, navigate to the “ColdFusion” category and select the “Cron Jobs” button.

    WCP_DomainControlPanel_ColdFusion_Cron_Job_Button

    Note: If this is your first cron job, the corresponding dialog box will be empty. As you continue to add jobs, jobs that you have added will appear upon successful creation.

  4. Select the “Add” button to configure your new cron job.


  5. Next, you will need to enter a name for your new cron job. Enter the task’s name into the “Name” field.

    Note: When entering a name you cannot use spaces or special characters. Only letters, numbers, and underscores are allowed.

    Example Name: “Invoice_Mailout”, “ScheduleReport”, “I_Dont_Need_A_Cron_I_Just_Want_1”

  1. After the name has been entered you will need to direct the task to a URL. This URL is the full HTTP request to the file that contains script you need to run. You cannot create a cron job to run a script of another URL, it needs to be a domain or subdomain associated with your WCP account.

    Note: You can also include URL variables in the URL to achieve a specific output based on your script.

    Example URL: http://hostektutorials.com/cron.cfm or https://hostektutorials.com/cron.cfm?id=123

  1. Below the “URL” field, you will see two radial options for “Easy” and “Advanced.” These options will influence your cron schedule expression options.

    We have created the custom option “Easy” to allow you quick access to more regular schedule expressions. Just select the interval from the “Time Interval” drop-down menu

    WCP_DomainControlPanel_ColdFusion_Cron_Job_Easy_Radial

    As needed, you can also switch the radial to the “Advanced” option for more specific cron schedule expressions.

    WCP_DomainControlPanel_Cron_Job_ColdFusion_Advanced_Radial

  2. Once the desired schedule has been determined, select the green “Save” button to confirm the creation of the Cron Job.

    If the Cron Job was successfully saved, you will be presented with a green success notification and directed back to the “Cron Jobs” dialog box.

  3. Now that a Cron Job has been created, you will see your cron job with the “Name”, “URL”, and “Schedule” columns.

    Note: The “Schedule” will be presented in a cron schedule expression as it appears on the Cron Job Server.


That’s It! Your Cron job has been successfully created and will run based on your schedule expression from the time of creation.

Editing An Existing Cron Job

Sometimes modifications are necessary to ensure that your schedule expression and URL for your Cron Jobs are working correctly. We have made editing your existing Cron Jobs quick and easy!

  1. After selecting the “Cron Jobs” button in the “ColdFusion” category, you will be presented with a list of the existing Cron Jobs.

  2. Locate the desired Cron Job by “Name” and click the pencil [:pencil_edit:] icon to enter the editing dialog box.

  3. The dialog box is exactly the same as the Cron Job creation window but will push the changes you make to the existing Cron Job by "Name"

    Note: It is important to remember that editing the name, url, or schedule will not generate a new Cron Job, you make changes to the existing Cron Job by “Name.” Subsequently, altering the Name of the Cron Job accidentally can make it difficult to locate again if you have a multiple existing Cron Jobs. Be careful what you save!

  4. When your changes look correct, select the green Save button to push the changes to the Cron Job Server and your changes will be available for the task upon the next scheduled firing.

Deleting An Existing Cron Job

When a Cron Job is no longer needed, you can remove it from your Cron Job list, which will alert the Cron Job Server to delete the task by name.

  1. After selecting the “Cron Jobs” button in the “ColdFusion” category, you will be presented with a list of the existing Cron Jobs.

  2. Locate the desired Cron Job by “Name” and click the Trashcan [:trashcan_delete:] icon to remove the Cron Job from the list.

    Note: This action is permanent! Once the Cron Job has been deleted you cannot get it back, you will need to re-create the Cron Job again.

  3. After selecting the trashcan[:trashcan_delete:] icon, a pop-up will display confirm your selection. To remove the Cron Job, select the “OK” or to exit without removing the Cron Job, select the “Cancel” button.

  4. If you selected the “OK” button, you will now see that the Cron Job has been removed from the list. There will also be a green success message informing you that the task was also removed from the Cron Job Server.