How to Schedule a Task
Tags: tutorial, webdev, devops
Published: 2020-08-24 08:53:40

Sometimes, some scripts or WordPress requires an automatic task to be performed. On www.amberit.org shared web hosting you can schedule these tasks to be automated. With the modern technology that we provide, you can also set automatic notifications via e-mail if task has run and what is the status, also there is an option that you can create an e-mail notification when the task has failed so that you know and can resolve the issues.

To schedule an automatic task:
1.You need to have an active Amber IT shared hosting, if you don't have one no worries you can order one and after the 1 payment is received you will automatically get access to our shared hosting control panel. If you make payment via PayPal or Credit card the hosting is activated in 5-10 minutes.

2.To created or see scheduled tasks for a subscription, go to Websites & Domains > Scheduled Tasks.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/x21tb67vavquwyx741my.png)

For every task in the list, you can change the settings of the task (by clicking on the task’s name), activate it by clicking the ![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/egpvdym2bjz45xnwgyeb.png) icon, deactivate it by clicking the ![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/gavsgyfkbx14rt3hsvmy.png) icon, or run the task immediately.

3.To create a scheduled task, go to Websites & Domains > Scheduled Tasks > Add Task.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/q7usa1r4n26brjrp61d4.png)

First, you need to select the task type, depending on your purpose:

Command. Specify the full path to the executable file to be run. This includes binary files, shell scripts, and batch files.
Fetch a URL. Specify the URL only; there is no need to type the command, such as “curl” or “wget”.
Run a PHP script. Specify the path to the script relative to your virtual host directory. You can click the

icon to quickly locate the script file. ![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/1ypsd6vhmg0xpsteqdyr.png)

Note: In Amber IT system for Linux all “Run a command” scheduled tasks by default are run in a chrooted environment. The home directory of a subscription’s system user is treated as the file system root for that subscription, and no executable files outside the chroot jail can be run. If you are encountering “file not found” errors during the execution of your scheduled tasks, try using paths relative to the system user’s home directory, and not absolute ones. If you need the ability to run executable files located outside the chroot jail, you would need to contact Amber IT support.
Next, select how often the task will run, and set the desired time and date. By default the time is in the server time zone; if you need to select a different time zone, go to Websites & Domains tab > Scheduled Tasks > Settings. You can also set a description for the task, and configure notifications.

Finally, before saving the task, you have the option to do a test run to make sure that the task is configured correctly. Click Run Now and wait for the task to finish. If the task finishes with an error, it will also fail to work when executed by the scheduler, unless you find and resolve the issue first.

If you have any questions, please feel free to contact our support and we will provide answers related to our hosting and it's advantages.