mirror of
https://github.com/caddyserver/caddy.git
synced 2025-02-02 22:27:10 +01:00
add --pidfile string option
As per https://github.com/mholt/caddy/issues/317
This commit is contained in:
parent
76ec785e87
commit
93c330c4ce
1 changed files with 11 additions and 2 deletions
13
main.go
13
main.go
|
@ -18,9 +18,10 @@ import (
|
|||
var (
|
||||
conf string
|
||||
cpu string
|
||||
version bool
|
||||
revoke string
|
||||
logfile string
|
||||
pidfile string
|
||||
revoke string
|
||||
version bool
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -36,6 +37,7 @@ func init() {
|
|||
flag.StringVar(&caddy.Root, "root", caddy.DefaultRoot, "Root path to default site")
|
||||
flag.StringVar(&caddy.Host, "host", caddy.DefaultHost, "Default host")
|
||||
flag.StringVar(&caddy.Port, "port", caddy.DefaultPort, "Default port")
|
||||
flag.StringVar(&pidfile, "pidfile", "", "Path to write pid file")
|
||||
flag.BoolVar(&version, "version", false, "Show version")
|
||||
// TODO: Boulder dev URL is: http://192.168.99.100:4000
|
||||
// TODO: Staging API URL is: https://acme-staging.api.letsencrypt.org
|
||||
|
@ -81,6 +83,13 @@ func main() {
|
|||
fmt.Printf("Revoked certificate for %s\n", revoke)
|
||||
os.Exit(0)
|
||||
}
|
||||
if pidfile != "" {
|
||||
pid := []byte(strconv.Itoa(os.Getpid()) + "\n")
|
||||
err := ioutil.WriteFile(pidfile, pid, 0644)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
// Set CPU cap
|
||||
err := setCPU(cpu)
|
||||
|
|
Loading…
Reference in a new issue