* move "pidFileName" to "config"
This commit is contained in:
parent
d3ddfc81a6
commit
f79008d9d0
@ -49,6 +49,7 @@ type configuration struct {
|
|||||||
ourConfigFilename string // Config filename (can be overridden via the command line arguments)
|
ourConfigFilename string // Config filename (can be overridden via the command line arguments)
|
||||||
ourWorkingDir string // Location of our directory, used to protect against CWD being somewhere else
|
ourWorkingDir string // Location of our directory, used to protect against CWD being somewhere else
|
||||||
firstRun bool // if set to true, don't run any services except HTTP web inteface, and serve only first-run html
|
firstRun bool // if set to true, don't run any services except HTTP web inteface, and serve only first-run html
|
||||||
|
pidFileName string // PID file name. Empty if no PID file was created.
|
||||||
// runningAsService flag is set to true when options are passed from the service runner
|
// runningAsService flag is set to true when options are passed from the service runner
|
||||||
runningAsService bool
|
runningAsService bool
|
||||||
disableUpdate bool // If set, don't check for updates
|
disableUpdate bool // If set, don't check for updates
|
||||||
|
@ -32,7 +32,6 @@ var httpsServer struct {
|
|||||||
sync.Mutex // protects config.TLS
|
sync.Mutex // protects config.TLS
|
||||||
shutdown bool // if TRUE, don't restart the server
|
shutdown bool // if TRUE, don't restart the server
|
||||||
}
|
}
|
||||||
var pidFileName string // PID file name. Empty if no PID file was created.
|
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// Used in config to indicate that syslog or eventlog (win) should be used for logger output
|
// Used in config to indicate that syslog or eventlog (win) should be used for logger output
|
||||||
@ -169,7 +168,7 @@ func run(args options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(args.pidFile) != 0 && writePIDFile(args.pidFile) {
|
if len(args.pidFile) != 0 && writePIDFile(args.pidFile) {
|
||||||
pidFileName = args.pidFile
|
config.pidFileName = args.pidFile
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update filters we've just loaded right away, don't wait for periodic update timer
|
// Update filters we've just loaded right away, don't wait for periodic update timer
|
||||||
@ -409,8 +408,8 @@ func stopHTTPServer() {
|
|||||||
|
|
||||||
// This function is called before application exits
|
// This function is called before application exits
|
||||||
func cleanupAlways() {
|
func cleanupAlways() {
|
||||||
if len(pidFileName) != 0 {
|
if len(config.pidFileName) != 0 {
|
||||||
os.Remove(pidFileName)
|
os.Remove(config.pidFileName)
|
||||||
}
|
}
|
||||||
log.Info("Stopped")
|
log.Info("Stopped")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user