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

# Cron Jobs

> Background automation in PropOps Web using scheduled cron scripts, n8n orchestration, secure webhook triggering, and audit logging.

PropOps Web uses scheduled cron scripts for background processing so operational work does not impact interactive site performance.

***

## What cron handles

Cron jobs run recurring maintenance, monitoring, and processing tasks such as:

* Session cleanup
* GDPR retention cleanup
* API health cleanup
* Commit archive purge
* Notification queue retention and database optimization
* Video queue processing
* Reminder and breach checks
* File integrity checks

***

## Execution model

PropOps Web supports two execution paths:

| Path              | How it works                                                             | Typical use                       |
| ----------------- | ------------------------------------------------------------------------ | --------------------------------- |
| **n8n scheduler** | n8n Schedule Trigger calls the cron webhook with an approved script name | Primary production scheduling     |
| **Direct CLI**    | Script executed from CLI by system scheduler                             | Local ops, fallback, one-off runs |

Most teams use n8n so workload is centralized and monitored outside the request path.

***

## Cron webhook security

Cron scripts exposed through the webhook endpoint are protected by:

* `X-Webhook-Token` validation
* Script allowlist validation (`script` must match an approved filename)
* Path traversal protection (`basename()` filtering)

Only approved scripts can be executed via webhook.

***

## Data deletion and audit logging

Cleanup and purge scripts that remove data write an audit entry to `user_activity_log` with system context.

Typical logged fields include:

* script name
* execution type (`cron`)
* records/files deleted
* retention cutoff details
* schedule context

This provides traceability for automated data lifecycle operations.

***

## Key retention controls

| Setting                              | Default | Purpose                                                  |
| ------------------------------------ | ------- | -------------------------------------------------------- |
| `GDPR_ACTIVITY_LOG_RETENTION_MONTHS` | `84`    | Retention window for activity logs and system email logs |
| `GDPR_REPORT_FILE_RETENTION_HOURS`   | `24`    | Retention window for GDPR/SAR generated report files     |

These settings are applied by cleanup scripts and should align with your organisational policy.

***

## Related documentation

* Admin controls: [/features/admin](/features/admin)
* Integrations and n8n setup: [/configuration/integrations](/configuration/integrations)
* Cron webhook API behavior: [/api/webhooks#cron-webhook](/api/webhooks#cron-webhook)
* Practical setup guide: [/guides/cron-job-management](/guides/cron-job-management)
