> ## Documentation Index
> Fetch the complete documentation index at: https://docs.startmyvpn.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Task Scheduler

> Setting up the Laravel cron scheduler for automated tasks.

The Laravel scheduler handles periodic tasks such as:

* Sending service expiration reminder emails
* Suspending overdue services
* Resetting monthly bandwidth counters
* Cleaning up expired WireGuard configurations

## Cron job setup

Add a single cron entry that runs every minute:

```bash theme={null}
sudo crontab -e -u www-data
```

Add this line:

```
* * * * * cd /var/www/startmyvpn && php artisan schedule:run >> /dev/null 2>&1
```

This is the only cron entry you need. Laravel's scheduler internally dispatches all timed tasks.

## Verify the scheduler is running

```bash theme={null}
php artisan schedule:list
```

This shows all registered scheduled commands and their next run time.

## Test locally

```bash theme={null}
php artisan schedule:work
```

This runs the scheduler in the foreground, executing due commands every minute — useful during development.
