# Task Scheduling

Test schedules that end will need to mark as expired. For that, we only need to add a single cron configuration entry to our server that runs the `schedule:run` command every minute.

### Setup Cron Job on Shared Hosting

To set up the cron job in shared hosting, follow the below steps.

Login to cPanel, go to the Cron Jobs page & add a new con job.

Minute, Hours, Days, Month, Weekday need to be set to **\***

![](/files/-MfHn9u6ZWZ8GriqeZ-T)

In the command input field, give the following command.

```
/usr/local/bin/php path-to-your-project/artisan schedule:run >> /dev/null 2>&1
```

{% hint style="warning" %}
Change the path and PHP version according to your hosting.
{% endhint %}

### Setup Cron Job on Cloud VPS

To set up the cron job, use the following command to edit the crontab file.

```
$ crontab -e
```

and add the following line to it.

```
* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1
```

{% hint style="warning" %}
Replace the project path with your application path.
{% endhint %}

![](/files/-MfIlOYRz_xUyqU0LZOQ)

Now reload cron service.

```
$ sudo service cron reload
```

### Run Cron Job on Local Host

Typically, you would not add a scheduler cron entry to your local development machine. Instead, you may use the `schedule:work` Artisan command. This command will run in the foreground and invoke the scheduler every minute until you terminate the command:

To run Cron Job on the local machine, go to the application folder and run the following command.

```
$ php artisan schedule:work
```

If it is windows, then open the command prompt and run the following command.

```
C:\xampp\htdocs\app_folder> php artisan schedule:work
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://nearchip.gitbook.io/qwiktest/installation/task-scheduling.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
