func handleSignals(srv *falcore.Server) {
	var sig os.Signal
	var sigChan = make(chan os.Signal)
	signal.Notify(sigChan, syscall.SIGHUP, syscall.SIGUSR1, syscall.SIGINT, syscall.SIGTERM, syscall.SIGTSTP)
	pid := syscall.Getpid()
	for {
		sig = <-sigChan
		switch sig {
		case syscall.SIGHUP:
			fmt.Println(pid, "Received SIGHUP.  forking.")
			cpid, err := forker(srv)
			fmt.Println(pid, "Forked pid:", cpid, "errno:", err)
		case syscall.SIGUSR1:
			fmt.Println(pid, "Received SIGUSR1.  Stopping accept.")
			srv.StopAccepting()
		case syscall.SIGINT:
			fmt.Println(pid, "Received SIGINT.  Shutting down.")
			os.Exit(0)
		case syscall.SIGTERM:
			fmt.Println(pid, "Received SIGTERM.  Terminating.")
			os.Exit(0)
		case syscall.SIGTSTP:
			fmt.Println(pid, "Received SIGTSTP.  Stopping.")
			syscall.Kill(pid, syscall.SIGSTOP)
		default:
			fmt.Println(pid, "Received", sig, ": ignoring")
		}
	}
}
Handle lifecycle events
package main
import (
	"flag"
	"fmt"
	"github.com/ngmoco/falcore"
	"net/http"
	"os"
	"os/signal"
	"runtime"
	"strconv"
	"strings"
	"syscall"
)
func Filter(request *falcore.Request) *http.Response {
	return falcore.SimpleResponse(request.HttpRequest, 200, nil, "OK\n")
}
var socketFd = flag.Int("socket", -1, "Socket file descriptor")
func main() {
	pid := syscall.Getpid()
	flag.Parse()
	pipeline := falcore.NewPipeline()
	pipeline.Upstream.PushBack(falcore.NewRequestFilter(Filter))
	srv := falcore.NewServer(8090, pipeline)
	if *socketFd != -1 {
		go childReady(srv)
		fmt.Printf("%v Got socket FD: %v\n", pid, *socketFd)
		srv.FdListen(*socketFd)
	}
	go handleSignals(srv)
	fmt.Printf("%v Starting Listener on 8090\n", pid)
	if err := srv.ListenAndServe(); err != nil {
		fmt.Printf("%v Could not start server: %v", pid, err)
	}
	fmt.Printf("%v Exiting now\n", pid)
}
func childReady(srv *falcore.Server) {
	pid := syscall.Getpid()
	<-srv.AcceptReady
	parent := syscall.Getppid()
	fmt.Printf("%v Kill parent %v with SIGUSR1\n", pid, parent)
	syscall.Kill(parent, syscall.SIGUSR1)
}
func forker(srv *falcore.Server) (pid int, err error) {
	var socket string
	if goVersion103OrAbove() {
		socket = "3"
	} else {
		socket = fmt.Sprintf("%v", srv.SocketFd())
	}
	fmt.Printf("Forking now with socket: %v\n", socket)
	mypath := os.Args[0]
	args := []string{mypath, "-socket", socket}
	attr := new(syscall.ProcAttr)
	attr.Files = append([]uintptr(nil), 0, 1, 2, uintptr(srv.SocketFd()))
	pid, err = syscall.ForkExec(mypath, args, attr)
	return
}
func goVersion103OrAbove() bool {
	ver := strings.Split(runtime.Version(), ".")
	if len(ver) > 0 && strings.Index(ver[0], "go") == 0 {
		if ver[0] == "go1" && len(ver) == 1 {
			return false
		} else if ver[0] == "go1" && len(ver) == 3 && ver[1] == "0" {
			if patchVer, _ := strconv.ParseInt(ver[2], 10, 64); patchVer < 3 {
				return false
			}
		}
	}
	return true
}