Exemple #1
0
func init() {
	parseFlag()

	log.SetOutput(os.Stdout)
	log.SetFlags(log.LstdFlags | log.Lmicroseconds | log.Lshortfile)
	server.SetupLogging("stdout", "info", "", "", "")
}
Exemple #2
0
func setupServant() *FunServantImpl {
	server.SetupLogging(".canbedeleted.test.log", "info", "", "", "")

	cf, _ := conf.Load("../etc/faed.cf")
	config.LoadEngineConfig(cf)
	server.LaunchHttpServer(":9999", "")
	return NewFunServant(config.Engine.Servants)
}
Exemple #3
0
func init() {
	parseFlags()

	if options.showVersion {
		server.ShowVersionAndExit()
	}

	server.SetupLogging(options.logFile, options.logLevel, options.crashLogFile, "", "")
}
Exemple #4
0
func init() {
	parseFlags()

	if options.showVersion {
		server.ShowVersionAndExit()
	}

	server.SetupLogging(options.logFile, options.logLevel,
		options.crashLogFile, options.alarmLogSock, options.alarmTag)

	// thrift lib use "log", so we also need to customize its behavior
	_log.SetFlags(_log.Ldate | _log.Ltime | _log.Lshortfile)

	if options.kill {
		s := server.NewServer("fae")
		s.LoadConfig(options.configFile)
		s.Launch()

		// stop new requests
		engine.NewEngine().
			LoadConfig(s.Conf).
			UnregisterEtcd()

		// finish all outstanding RPC sessions
		if err := signal.SignalProcessByPidFile(options.lockFile,
			syscall.SIGUSR1); err != nil {
			fmt.Fprintf(os.Stderr, "stop failed: %s\n", err)
			os.Exit(1)
		}

		cleanup() // TODO wait till that faed process terminates, who will do the cleanup

		fmt.Println("faed killed")

		os.Exit(0)
	}

	if options.lockFile != "" {
		if locking.InstanceLocked(options.lockFile) {
			fmt.Fprintf(os.Stderr, "Another instance is running, exit...\n")
			os.Exit(1)
		}

		locking.LockInstance(options.lockFile)
	}

}