Skip to content

Commit 06d4f72

Browse files
committedMay 26, 2021
update readme
1 parent e0abac7 commit 06d4f72

File tree

1 file changed

+28
-9
lines changed

1 file changed

+28
-9
lines changed
 

‎README.md

+28-9
Original file line numberDiff line numberDiff line change
@@ -41,28 +41,29 @@ exec [<matcher>] [<command> [<args...>]] {
4141
- **log** - [Caddy log output module](https://caddyserver.com/docs/caddyfile/directives/log#output-modules) for standard output log. Defaults to `stderr`.
4242
- **err_log** - [Caddy log output module](https://caddyserver.com/docs/caddyfile/directives/log#output-modules) for standard error log. Defaults to the value of `log` (standard output log).
4343
- **foreground** - if present, runs the command in the foreground. For commands at http endpoints, the command will exit before the http request is responded to.
44-
- **startup** - if present, run the command at startup. Disables http endpoint.
45-
- **shutdown** - if present, run the command at shutdown. Disables http endpoint.
44+
- **startup** - if present, run the command at startup. Ignored in routes.
45+
- **shutdown** - if present, run the command at shutdown. Ignored in routes.
4646

4747
#### Example
4848

49-
`exec` can start php-fpm via the [global](https://caddyserver.com/docs/caddyfile/options) directive.
49+
`exec` can run at start via the [global](https://caddyserver.com/docs/caddyfile/options) directive.
5050

5151
```
5252
{
5353
exec hugo generate --destination=/home/user/site/public {
54-
timeout 0 # run indefinitely
55-
log file /var/logs/hugo.log
54+
timeout 0 # don't timeout
5655
}
5756
}
5857
```
5958

6059
`exec` can be the last action of a route block.
6160

6261
```
63-
route /generate {
62+
route /update {
6463
... # other directives e.g. for authentication
65-
exec hugo generate --destination=/home/user/site/public
64+
exec git pull origin master {
65+
log file /var/logs/hugo.log
66+
}
6667
}
6768
```
6869

@@ -96,6 +97,15 @@ As a top level app for `startup` and `shutdown` commands.
9697
"foreground": false,
9798
// [optional] timeout to terminate the command's process. Default is 10s.
9899
"timeout": "10s",
100+
// [optional] log output module config for standard output. Default is `stderr` module.
101+
"log": {
102+
"output": "file",
103+
"filename": "/var/logs/hugo.log"
104+
},
105+
// [optional] log output module config for standard error. Default is the value of `log`.
106+
"err_log": {
107+
"output": "stderr"
108+
}
99109
}
100110
]
101111
}
@@ -127,12 +137,21 @@ As an handler within a route.
127137
// [optional] if the command should run on the foreground. Default is false.
128138
"foreground": true,
129139
// [optional] timeout to terminate the command's process. Default is 10s.
130-
"timeout": "5s"
140+
"timeout": "5s",
141+
// [optional] log output module config for standard output. Default is `stderr` module.
142+
"log": {
143+
"output": "file",
144+
"filename": "/var/logs/hugo.log"
145+
},
146+
// [optional] log output module config for standard error. Default is the value of `log`.
147+
"err_log": {
148+
"output": "stderr"
149+
}
131150
}
132151
],
133152
"match": [
134153
{
135-
"path": ["/generate"]
154+
"path": ["/update"]
136155
}
137156
]
138157
}

0 commit comments

Comments
 (0)
Please sign in to comment.