2020-02-02 21:20:39 +00:00
|
|
|
// +build !windows
|
|
|
|
|
|
|
|
package service
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"os/signal"
|
|
|
|
"syscall"
|
|
|
|
|
|
|
|
"github.com/drakkan/sftpgo/dataprovider"
|
2020-07-29 19:56:56 +00:00
|
|
|
"github.com/drakkan/sftpgo/ftpd"
|
2020-02-04 22:21:33 +00:00
|
|
|
"github.com/drakkan/sftpgo/httpd"
|
2020-02-02 21:20:39 +00:00
|
|
|
"github.com/drakkan/sftpgo/logger"
|
2020-08-11 21:56:10 +00:00
|
|
|
"github.com/drakkan/sftpgo/webdavd"
|
2020-02-02 21:20:39 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func registerSigHup() {
|
|
|
|
sig := make(chan os.Signal, 1)
|
|
|
|
signal.Notify(sig, syscall.SIGHUP)
|
|
|
|
go func() {
|
|
|
|
for range sig {
|
|
|
|
logger.Debug(logSender, "", "Received reload request")
|
2020-04-30 12:23:55 +00:00
|
|
|
err := dataprovider.ReloadConfig()
|
|
|
|
if err != nil {
|
|
|
|
logger.Warn(logSender, "", "error reloading dataprovider configuration: %v", err)
|
|
|
|
}
|
|
|
|
err = httpd.ReloadTLSCertificate()
|
|
|
|
if err != nil {
|
|
|
|
logger.Warn(logSender, "", "error reloading TLS certificate: %v", err)
|
|
|
|
}
|
2020-07-29 19:56:56 +00:00
|
|
|
err = ftpd.ReloadTLSCertificate()
|
|
|
|
if err != nil {
|
|
|
|
logger.Warn(logSender, "", "error reloading FTPD TLS certificate: %v", err)
|
|
|
|
}
|
2020-08-11 21:56:10 +00:00
|
|
|
err = webdavd.ReloadTLSCertificate()
|
|
|
|
if err != nil {
|
|
|
|
logger.Warn(logSender, "", "error reloading WebDav TLS certificate: %v", err)
|
|
|
|
}
|
2020-02-02 21:20:39 +00:00
|
|
|
}
|
|
|
|
}()
|
|
|
|
}
|