v0.4.0
Some checks failed
ci/woodpecker/push/gitea Pipeline was successful
ci/woodpecker/push/go-lint Pipeline failed
ci/woodpecker/tag/gitea Pipeline failed
ci/woodpecker/tag/go-lint Pipeline failed
ci/woodpecker/tag/publish-docs Pipeline is running
ci/woodpecker/push/publish-docs Pipeline was successful

This commit is contained in:
2023-09-08 23:42:13 -05:00
parent 6ccb75f4fa
commit a4214b2b3f
25 changed files with 522 additions and 375 deletions

View File

@ -19,6 +19,7 @@ Available Commands:
cron Starts a scheduler that runs lists defined in config file.
exec Runs commands defined in config file in order given.
help Help about any command
list Lists commands, lists, or hosts defined in config file.
version Prints the version and exits
Flags:
@ -91,7 +92,7 @@ Usage:
Flags:
-h, --help help for version
-n, --num Output the version number only. (default true)
-n, --num Output the version number only.
-V, --vpre Output the version with v prefixed.
Global Flags:
@ -99,3 +100,20 @@ Global Flags:
-v, --verbose Sets verbose level
```
## list
```
Backup lists commands or groups defined in config file.
Use the --lists or -l flag to list the specified lists. If not flag is not given, all lists will be executed.
Usage:
backy list [--list=list1,list2,... | -l list1, list2,...] [ -cmd cmd1 cmd2 cmd3...] [flags]
Flags:
-h, --help help for list
-l, --lists strings Accepts comma-separated names of command lists to list.
Global Flags:
-f, --config string config file to read from
-v, --verbose Sets verbose level
```

View File

@ -16,8 +16,8 @@ The top-level object key can be anything you want but not the same as another.
- test
- test2
notifications:
- prod-email
- matrix
- mail.prod-email
- matrix.sysadmin
cron: "0 * * * * *"
```
@ -25,9 +25,9 @@ The top-level object key can be anything you want but not the same as another.
| --- | --- | --- | --- |
| `order` | Defines the sequence of commands to execute | `[]string` | yes |
| `getOutput` | Command(s) output is in the notification(s) | `bool` | no |
| `notifications` | The notification IDs to use on success and failure | `[]string` | no |
| `notifications` | The notification service(s) and ID(s) to use on success and failure. Must be *`service.id`*. See the [notifications documentation page](/config/notifications/) for more | `[]string` | no |
| `name` | Optional name of the list | `string` | no |
| `cron` | Time at which to schedule the list. | `string` | no |
| `cron` | Time at which to schedule the list. Only has affect when cron subcommand is run. | `string` | no |
### Order
@ -43,7 +43,7 @@ order:
Get command output when a notification is sent.
Is not required. Can be `true` or `false`.
Is not required. Can be `true` or `false`. Default is `false`.
### Notifications
@ -57,29 +57,30 @@ Name is optional for logging. If name is not defined, name will be the object's
Backy also has a cron mode, so one can run `backy cron` and start a process that schedules jobs to run at times defined in the configuration file.
Adding `cron: 0 0 1 * * *` to a `cmd-configs` object will schedule the list at 1 in the morning. See [https://crontab.guru/](https://crontab.guru/) for reference.
Adding `cron: 0 0 1 * * *` to a `cmd-lists` object will schedule the list at 1 in the morning. See [https://crontab.guru/](https://crontab.guru/) for reference.
{{% notice tip %}}
Note: Backy uses the second field of cron, so add anything except * to the beginning of a regular cron expression.
{{% /notice %}}
```yaml
cmd-configs:
  cmds-to-run: # this can be any name you want
cmd-lists:
  docker-container-backup: # this can be any name you want
    # all commands have to be defined
    order:
      - stop-docker-container
      - backup-docker-container-script
      - shell-cmd
      - hostname
      - start-docker-container
    notifications:
      - matrix
    name: backup-some-server
      - matrix.id
    name: backup-some-container
    cron: "0 0 1 * * *"
  hostname:
    name: hostname
    order:
      - hostname
    notifications:
    - prod-email
    - mail.prod-email
```

View File

@ -10,33 +10,33 @@ Notifications can be sent on command list completion and failure.
The supported platforms for notifications are email (SMTP) and [Matrix](https://matrix.org/).
Notifications are defined by type. The top-level object will be the id, and the `type` is required.
Notifications are defined by service, with the current form following below. Ids must come after the service.
```yaml
notifications:
prod-email:
type: mail
host: yourhost.tld
port: 587
senderaddress: email@domain.tld
to:
- admin@domain.tld
username: smtp-username@domain.tld
password: your-password-here
mail:
prod-email:
host: yourhost.tld
port: 587
senderaddress: email@domain.tld
to:
- admin@domain.tld
username: smtp-username@domain.tld
password: your-password-here
matrix:
type: matrix
home-server: your-home-server.tld
room-id: room-id
access-token: your-access-token
user-id: your-user-id
matrix:
home-server: your-home-server.tld
room-id: room-id
access-token: your-access-token
user-id: your-user-id
```
Types recognized are `type: mail` and `type: matrix`
Sections recognized are `mail` and `matrix`
The type's object and its keys are listed below.
There must be a section with an id (eg. `mail.test-svr`) following one of these sections.
### type: mail
### mail
| key | description | type
| --- | --- | ---
@ -47,7 +47,7 @@ The type's object and its keys are listed below.
| `username` | SMTP username | `string`
| `password` | SMTP password | `string`
### type: matrix
### matrix
| key | description | type
| --- | --- | ---