Commit 93c330c4 authored by AJ ONeal's avatar AJ ONeal

add --pidfile string option

As per https://github.com/mholt/caddy/issues/317
parent 76ec785e
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment