# New-File

> Creates a new Schedule config file locally containing example Schedules.

Creates a new Schedule config file locally containing example Schedules.

The generated `.sched` file contains examples of each supported schedule type:

| Type      | Schedule format                                                                |
| --------- | ------------------------------------------------------------------------------ |
| recurring | A five-field cron expression. The minimum frequency is once per hour.          |
| one-time  | An RFC3339 timestamp.                                                          |
| interval  | A fixed period such as `90m`, `3d`, or `2w`. The minimum period is 60 minutes. |

An interval has the format `<number><unit>`, where the supported units are `m` (minutes), `h` (hours), `d` (days), and `w` (weeks). Combined units such as `1d12h` are not supported. Intervals are fixed periods and do not reset at month boundaries.

When an interval schedule specifies `StartAt`, its cadence is anchored to that timestamp. Otherwise, its cadence is aligned to the Unix epoch and its first occurrence is the next aligned boundary, which might be sooner than one full interval after creation.

`StartAt` and `EndAt` are optional RFC3339 timestamps that define when a recurring or interval schedule becomes active and when it stops being active. `StartAt` also anchors an interval schedule's cadence. Set either field to `null` when no boundary is required. One-time schedules use the timestamp in `Schedule`, so they don't require `StartAt` or `EndAt`.

For example:

```json
{
  "$schema": "https://ugs-config-schemas.unity3d.com/v1/schedules.schema.json",
  "Configs": {
    "RecurringSchedule": {
      "EventName": "EventType1",
      "Type": "recurring",
      "Schedule": "0 * * * *",
      "PayloadVersion": 1,
      "Payload": "{}",
      "StartAt": "2099-01-01T00:00:00Z",
      "EndAt": "2099-12-31T23:59:59Z"
    },
    "OneTimeSchedule": {
      "EventName": "EventType2",
      "Type": "one-time",
      "Schedule": "2099-01-01T00:00:00Z",
      "PayloadVersion": 1,
      "Payload": "{ \"message\": \"Hello, world!\" }",
      "StartAt": null,
      "EndAt": null
    },
    "IntervalSchedule": {
      "EventName": "EventType3",
      "Type": "interval",
      "Schedule": "3d",
      "PayloadVersion": 1,
      "Payload": "{}",
      "StartAt": "2099-01-01T00:00:00Z",
      "EndAt": null
    }
  }
}
```

## Command

Authentication Required: `No`

```text
ugs scheduler new-file <file-name> [options]
```

## Arguments

`<file-name>` The name of the file to create

## Options

|       | Alias          | Description                         |
| ----- | -------------- | ----------------------------------- |
| force | -f, --force    | Overwrites existing file            |
| help  | -?, -h, --help | Display help and usage information. |
| quiet | -q, --quiet    | Reduce logging to a minimum.        |
| json  | -j, --json     | Use JSON as the output format.      |
