Compare commits
No commits in common. "e02737abd13bde9c12a5f1aa526d0e8de2a58416" and "88a751c59055cd1d1bc29e7e2ff492e7321abfce" have entirely different histories.
e02737abd1
...
88a751c590
|
@ -6,8 +6,6 @@ Yes, I know Gotify doesn't have "goat" in its name but it sounds like it.
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
Configuration lives in a TOML file which should have (at a minimum) the following:
|
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
server = "https://gotify.example.com"
|
server = "https://gotify.example.com"
|
||||||
app_token = "app_token_from_gotify"
|
app_token = "app_token_from_gotify"
|
||||||
|
@ -17,7 +15,7 @@ app_token = "app_token_from_gotify"
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```
|
```
|
||||||
goat_monitor --config ./config.toml --retries 3 -- <COMMAND TO MONITOR>
|
goat_monitor --config ./config.toml --retries -1 -- <COMMAND TO MONITOR>
|
||||||
```
|
```
|
||||||
|
|
||||||
The command can be any shell command including arbitrarily many options / arguments.
|
The command can be any shell command including arbitrarily many options / arguments.
|
||||||
|
|
|
@ -17,8 +17,7 @@ from goat_monitor._version import __version__ # type: ignore
|
||||||
@click.argument("command", nargs=-1, required=False, type=str)
|
@click.argument("command", nargs=-1, required=False, type=str)
|
||||||
@click.option(
|
@click.option(
|
||||||
"--config",
|
"--config",
|
||||||
# default="~/.config/goat_monitor.toml",
|
default="~/.config/goat_monitor.toml",
|
||||||
required=True,
|
|
||||||
type=click.Path(path_type=Path),
|
type=click.Path(path_type=Path),
|
||||||
help="Use a .toml configuration file",
|
help="Use a .toml configuration file",
|
||||||
)
|
)
|
||||||
|
@ -59,8 +58,7 @@ def wrap(command: List[str], config: Path, retries: int, version):
|
||||||
if retries < 0:
|
if retries < 0:
|
||||||
raise ValueError("Invalid number of retries specified")
|
raise ValueError("Invalid number of retries specified")
|
||||||
|
|
||||||
attempt = 0
|
for attempt in range(retries + 1):
|
||||||
while attempt <= retries:
|
|
||||||
# run the command
|
# run the command
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
" ".join(command),
|
" ".join(command),
|
||||||
|
@ -102,8 +100,6 @@ def wrap(command: List[str], config: Path, retries: int, version):
|
||||||
# only retry on failure
|
# only retry on failure
|
||||||
break
|
break
|
||||||
|
|
||||||
attempt += 1
|
|
||||||
|
|
||||||
sys.exit(result.returncode)
|
sys.exit(result.returncode)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user