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

# Scheduler

> Create and manage scheduled tasks, cron jobs, and automated processes on your servers in Loupp for efficient task automation.

## Overview

Create and manage automated tasks that run at specified intervals on your servers.

## Creating Scheduled Tasks

<Steps>
  <Step title="Access scheduler">
    Navigate to your server dashboard and click on the "Scheduler" tab.
  </Step>

  <Step title="Configure task details">
    * **Label**: Descriptive name for your task
    * **Command**: Command to execute
    * **Sudo User**: loupp or root
    * **Schedule**: Frequency or custom cron expression
  </Step>

  <Step title="Set schedule frequency">
    Choose from predefined schedules or create custom cron expressions:

    * Every Minute: `* * * * *`
    * Hourly: `0 * * * *`
    * Nightly: `0 0 * * *`
    * Daily: `0 0 * * *`
    * Weekly: `0 0 * 0 *`
    * Monthly: `0 0 1 * *`
    * Custom: Define your own cron expression
  </Step>

  <Step title="Create task">
    Click "Create Scheduler" to add the task to the server's cron configuration.
  </Step>
</Steps>

<Warning>
  Only create and delete operations are supported. Edit requires recreation.
</Warning>

## Default Schedulers

New projects automatically get:

<CardGroup cols={2}>
  <Card title="Auto Clean" icon="trash">
    **Schedule**: `0 0 * * 0` (Weekly Sunday)
    **Command**: `sudo apt-get autoremove && sudo apt-get autoclean`
    **User**: root
  </Card>

  <Card title="Composer Update" icon="refresh">
    **Schedule**: `30 00 * * *` (Daily 12:30 AM)
    **Command**: `/usr/local/bin/composer self-update`
    **User**: root
  </Card>
</CardGroup>

## Security

* Use `loupp` for application tasks, `root` only when needed
* Validate commands to prevent injection
* Regular audit of scheduled tasks

## Troubleshooting

### Common Issues

<AccordionGroup>
  <Accordion title="Task Not Running">
    * Verify cron service is running
    * Check schedule configuration
    * Ensure user permissions
    * Review cron logs
  </Accordion>

  <Accordion title="Permission Errors">
    * Check user permissions
    * Verify file paths and access rights
    * Check user shell configuration
  </Accordion>
</AccordionGroup>
