# Automation Settings

https://docs.wisecp.com/fr/automation-settings

The Settings tab holds the rules automation follows, from when invoices go out to how the server reaches WISECP.

## Opening the Screen

Panel menu: **Settings** then **Automation**, and the **Settings** tab: `{admin}/automation?tab=settings`

It opens on **System**. Each group has its own address, for example `{admin}/automation?tab=settings&settings=invoice`

Staff without the automation right see an access message.

## What Is on the Screen

A note at the top warns that nothing here works until the server calls WISECP every minute.

- **System**: Crontab command, processing hours, retention, secret.
- **Invoice Settings**: Creation, reminders, late fee, cancellation and deletion.
- **Product/Service Settings**: Suspension, cancellation, server removal, orders, domain notices.
- **Support System Settings**: Closing and locking silent tickets.
- **Other Settings**: Log cleanup and account deletion.

Each group has its own **Save Changes** button, and it saves that group alone.

In most day fields, **0** switches the rule off.

### The restore warning

A red panel appears at the top of the Automation screen when the worker starts again after a long silence. That usually follows a restore from backup. It names the gap and when it was noticed.

## Fields

### System

- **Crontab Setup**: The command to add on your server, in three forms: **Hosting Panel**, **CLI** and **CURL**. Read only, with a copy button.
- **Monitor URL**: The same address for an external monitoring service, with a copy button and links to four services.
- **Processing Time Range**: Two clock boxes. Selected tasks run only between them. The range must cover at least one hour.
- **Data Retention**: Three day counts for finished, cancelled and failed job records. Minimum 1; defaults 30, 7 and 30.
- **Dry run (count) and Run Cleanup Now**: The first counts what would go. The second deletes it after a confirmation.
- **Cron Secret**: The token inside the cron address, masked. **Show**, a copy button and **Regenerate** sit beside it. On an installation running in demo mode the token, the install path in the commands and the worker names in job lists stay hidden, and **Run Self-Test** is turned off.

### Invoice Settings

- **Create Invoice**: Days ahead of the due date a renewal invoice is written, asked for periods over 30 days and for 30 day periods. A third box caps how many past unbilled periods one round invoices.
- **Invoice Reminder**: Three reminders, each set as days before the due date.
- **Overdue Payment**: Three further notices, each set as days after the due date.
- **Apply Late Fee**: A switch, the day it applies, and the type: **Percentage** or **Fixed Amount**. Then the amount, a minimum, and how often it repeats.
- **Invoice Cancellation**: Days after the due date an unpaid invoice is cancelled.
- **Delete Invoice**: Days after the due date a cancelled invoice is deleted.

### Product/Service Settings

The first five carry a switch and a day count; that switch is the same one as the play and pause buttons in the task list.

- **Suspend**: Days after the due date an unpaid service is suspended.
- **Disable Metric on Unpaid Metered Invoice**: Days after an unpaid usage invoice the metric behind it is switched off.
- **Suspend on Unpaid Metered Invoice**: Days after an unpaid usage invoice the service itself is suspended.
- **Cancellation**: Days after the due date a suspended service is cancelled.
- **Delete From Server**: Days after the due date the account is removed from the hosting server.
- **Stale Order Purge**: Days before an abandoned cart is deleted for good.
- **Stale Order Expire**: Days before an abandoned cart is marked cancelled. The record is kept.
- **Domain Name Upcoming Renewal Notifications**: Five notices, each set as days before the domain expires.
- **Domain Expired Notice**: Days after expiry before the client is told the domain has expired.

### Support System Settings

- **Close Ticket**: A switch and a day count: how long a client can stay silent before the ticket closes.
- **Lock Ticket**: A switch and a day count for locking a ticket that closed this way.

### Other Settings

- **Clear Logs**: A switch and a day count: how long activity records are kept.
- **Delete Unverified Accounts**: Days before an unverified account is deleted. Clients with a service or a paid invoice are kept.
- **Delete Accounts Without Orders**: Days before an account that never ordered anything is deleted.

## Tasks

### Set the server up to call WISECP

1. Open **System** and pick the form that matches your server.
2. Copy the command and add it to your server, set to run every minute.
3. On the Overview tab, use **Run Self-Test** to confirm the call arrives.

### Shorten how long job records are kept

1. In **Data Retention**, set the three day counts and click **Save Changes**.
2. Click **Dry run (count)**.
3. If the numbers look right, click **Run Cleanup Now** and confirm. The regular cleanup task uses the same limits.

### Start charging late fees

1. Open **Invoice Settings** and switch on **Apply Late Fee**.
2. Set the day, the type, the amount and the minimum.
3. Pick the **Application Cycle** and click **Save Changes**. Charges start on the next round.

### Replace the cron secret

1. In **System**, click **Regenerate** beside the secret and confirm.
2. The page reloads with a new token.
3. Copy the new command into your server and into every monitoring service you use.

## Things to Watch

> **A new secret stops the old address working**
> 
> Any HTTP cron address you set up before, in the crontab or at a monitoring service, fails from that moment. Update them all, then check with **Run Self-Test**.

> **A suspected restore empties the queue**
> 
> When the system spots the gap, the waiting jobs are deleted and every open task is pushed 24 hours ahead. **False Alarm** only removes the warning; run the tasks by hand to catch up.

> **Cleanup deletes for good**
> 
> **Run Cleanup Now** removes old job records with their logs and results. Count them with the dry run first: a short retention on failed jobs takes away errors you may still need.

> **Invoice cancellation depends on service cancellation**
> 
> An invoice cancellation day is refused while **Cancellation** under Product/Service is off, and switching that off is refused while a day is set.

## Required Privileges

Every group here, and the cleanup and secret buttons, need `AUTOMATION_SETTINGS`.

## Related Articles

- [Automation Overview](https://docs.wisecp.com/en/automation-overview)
- [Automation Activity](https://docs.wisecp.com/en/automation-activity)
- [Activity Logs](https://docs.wisecp.com/en/action-logs)
