You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-**log** - [Caddy log output module](https://caddyserver.com/docs/caddyfile/directives/log#output-modules) for standard output log. Defaults to `stderr`.
42
42
-**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).
43
43
-**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.
46
46
47
47
#### Example
48
48
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.
50
50
51
51
```
52
52
{
53
53
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
56
55
}
57
56
}
58
57
```
59
58
60
59
`exec` can be the last action of a route block.
61
60
62
61
```
63
-
route /generate {
62
+
route /update {
64
63
... # 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
+
}
66
67
}
67
68
```
68
69
@@ -96,6 +97,15 @@ As a top level app for `startup` and `shutdown` commands.
96
97
"foreground":false,
97
98
// [optional] timeout to terminate the command's process. Default is 10s.
98
99
"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
+
}
99
109
}
100
110
]
101
111
}
@@ -127,12 +137,21 @@ As an handler within a route.
127
137
// [optional] if the command should run on the foreground. Default is false.
128
138
"foreground":true,
129
139
// [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`.
0 commit comments