diff --git a/backend.go b/backend.go index ad74e22..0f65092 100644 --- a/backend.go +++ b/backend.go @@ -104,7 +104,7 @@ func backendServer() { } func runBackendServer() { - proc := exec.Command(os.Args[0], "-datadir", dataDir, "backend") + proc := exec.Command(os.Args[0], reexecArgs("backend")...) proc.Stdout = os.Stdout proc.Stderr = os.Stderr err := proc.Start() diff --git a/honk.go b/honk.go index 8027fbb..6f031e2 100644 --- a/honk.go +++ b/honk.go @@ -259,6 +259,13 @@ func unplugserver(hostname string) { db.Exec("delete from doovers where rcpt like ?", xid) } +func reexecArgs(cmd string) []string { + args := []string{"-datadir", dataDir} + args = append(args, loggingArgs()...) + args = append(args, cmd) + return args +} + func main() { flag.StringVar(&dataDir, "datadir", dataDir, "data directory") flag.StringVar(&viewDir, "viewdir", viewDir, "view directory") diff --git a/log.go b/log.go index ff4e971..bb441fc 100644 --- a/log.go +++ b/log.go @@ -42,6 +42,10 @@ func init() { } +func loggingArgs() []string { + return []string{"-errorlog", elogname, "-infolog", ilogname, "-debuglog", dlogname} +} + func initLogging(elogname, ilogname, dlogname string) { elog = openlog(elogname, syslog.LOG_ERR) ilog = openlog(ilogname, syslog.LOG_INFO)