Scheduled Tasks Tutorial

Why Scheduled Tasks?

Sometimes, you want to send emails or do database work on a regular schedule without having to click on a page. The reason I needed to know this is because I have a calendar database. People have signed up to bring doughnuts and need to be reminded. Once a week I need the system to send an email to that person to remind them and to update the database.

What technology is behind this?

Cron is a standard Linux feature that allows you to schedule tasks, called “Cron Jobs,” to run unattended at a specified frequency. You can quickly set up a Basic Cron Job schedule using the Cron Manager Feature in the GoDaddy Hosting Control Center. You can have a maximum of 10 Cron Jobs set up at any one time.

Tutorial

First, you need to put the code that you wish to execute on the Server. You can do this in the Godaddy Hosting Control Center – Your Files. Navigate to the Calendar Folder, select the folders and click Permissions. Check the settings below. Make sure you set the permissions for your .php file to executable.
exePermissions
Note – You will need to reset the permissions every time you upload a new version of the PHP file.

To Create a Basic Cron Job

Instructions from the Godaddy Help Page

  1. Log in to your Account Manager.
  2. In the My Products section, select Hosting.
  3. Next to the hosting account you want to modify, click Manage Account.
  4. In the Content section of the Hosting Control Center, click the Cron Manager icon. This action displays the Cron Manager screen.
  5. Click edit next to the Email Address heading in the left navigation area.
  6. Enter the email address to which you would like to have all information sent regarding this Cron Job.
  7. Click Save.
  8. Click Create Cron Job.
    Cron Job Title
    Enter a name for this Cron Job. Ideally, this title relates to this task, so you can identify it easily.

    Command
    The Command field is the script or executable that runs at a specified frequency. Click Browse to locate a file in your hosting account.

    The full file name of your selection is placed into this editable field. Click the question mark icon for additional assistance in selecting a command.

    Frequency
    Set the frequency at which you want this Cron Job to run: Hourly, Daily, Weekly, or Monthly.

    Minute/Hour/Day/Date
    Depending on which Frequency setting you select, this lower-right field will display differently.

    Hourly – Displays the Minute field. Enter the time that you want the Cron Job to run. For example, you can set your job to run at 15 minutes after each hour by selecting “x:15.”

    Daily – Displays the Hour field. Enter the time of day that you want the Cron Job to run. For example, you can set your job to run each day at 1:00 p.m. by selecting “13:xx.”

    Weekly – Displays the Day and Hour field. Enter the day and the time of day that you want the Cron Job to run. For example, you can set your job to run each Thursday at 7:00 a.m. by selecting “Thursday” and “07:xx.”

    Monthly – Displays the Date and Hour field. Enter the date and the time of day that you want the Cron Job to run. For example, you can set your job to run on the 15th of each month at Midnight by selecting “15” and “00:xx.”

  9. Enter the required information in each field to schedule the task to run repeatedly at specific intervals.
  10. Click Save.
    Your Cron Job is saved, enabled, and runs at the next scheduled interval.

Author: Steph

Share This Post On

Pin It on Pinterest

Share This