Shareable Git-powered notebooks
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

31 lines
574 B

// +build !windows
package main
import (
"log"
"os"
"os/signal"
"syscall"
)
func registerSignalHandlers() {
sigc := make(chan os.Signal, 1)
signal.Notify(sigc, syscall.SIGUSR1, syscall.SIGUSR2)
go func() {
for sig := range sigc {
switch sig {
case syscall.SIGUSR1:
// TODO: Reload config
case syscall.SIGUSR2:
log.Println("Compacting notebooks...")
stick.NotebooksLock.Lock()
for _, notebook := range stick.Notebooks {
notebook.compact()
}
stick.NotebooksLock.Unlock()
log.Println("Compacted notebooks")
}
}
}()
}