added some features

- Added `cron` command to run lists with `cron` time specifed
- Changed `-c` flag to `-f` flag for passing config file
- Modified some config keys
  - cmdArgs -> Args
  - Got rid of `hosts.config`
- better SSH handling
  - respects values in config file
This commit is contained in:
2023-02-01 23:45:23 -06:00
parent 03f54c8714
commit 059f4c0097
19 changed files with 1359 additions and 786 deletions

View File

@ -25,7 +25,7 @@ To run a config:
`backy backup`
Or to use a specific file:
```backy backup -c /path/to/file```
```backy backup -f /path/to/file```
If you leave the config path blank, the following paths will be searched in order:
@ -38,28 +38,26 @@ Create a file at `~/.config/backy.yaml`:
commands:
stop-docker-container:
cmd: docker
cmdArgs:
Args:
- compose
- -f /some/path/to/docker-compose.yaml
- down
# if host is not defined,
# if host is not defined, cmd will be run locally
host: some-host
env: ~/path/to/env/file
backup-docker-container-script:
cmd: /path/to/script
# The host has to be defined in the config file
host: some-host
env: ~/path/to/env/file
shell-cmd:
cmd: rsync
shell: bash
cmdArgs:
Args:
- -av some-host:/path/to/data ~/Docker/Backups/docker-data
hostname:
cmd: hostname
cmd-configs:
# this can be any name you want
cmds-to-run:
cmds-to-run: # this can be any name you want
# all commands have to be defined
order:
- stop-docker-container
@ -68,7 +66,9 @@ cmd-configs:
- hostname
notifications:
- matrix
name: backup-some-server
hostname:
name: hostname
order:
- hostname
notifications:
@ -76,22 +76,26 @@ cmd-configs:
hosts:
some-host:
config:
usefile: true
user: root
private-key-path:
hostname: some-hostname
config: ~/.ssh/config
user: user
privatekeypath: /path/to/private/key
port: 22
password:
logging:
verbose: true
file: /path/to/logs/commands.log
console: false
cmd-std-out: false
notifications:
prod-email:
id: prod-email
type: mail
host: yourhost.tld
port: 587
host: yourhost.tld:port
senderAddress: email@domain.tld
to:
- admin@domain.tld
@ -100,11 +104,9 @@ notifications:
matrix:
id: matrix
type: matrix
homeserver: your-home-server.tld
home-server: your-home-server.tld
room-id: room-id
access-token: your-access-token
user-id: your-user-id
```
Note, let me know if a path lookup fails due to using Go's STDLib `os`