Beispiel #1
0
func registerControlCommandsAt(app *cli.App) {
	clientFactory := client.NewFactory(conf.Instance())

	commonClientFlags := []cli.Flag{}

	app.Commands = append(app.Commands,
		createConfigCommand(commonClientFlags, clientFactory),
		createControlConfigCommand(commonClientFlags, clientFactory),
		createServicesCommand(commonClientFlags, clientFactory),
		createServiceCommand(commonClientFlags, clientFactory),
		createServiceConfigCommand(commonClientFlags, clientFactory),
		createServiceStatusCommand(commonClientFlags, clientFactory),
		createServicePidCommand(commonClientFlags, clientFactory),
		createStartServiceCommand(commonClientFlags, clientFactory),
		createRestartServiceCommand(commonClientFlags, clientFactory),
		createStopServiceCommand(commonClientFlags, clientFactory),
		createKillServiceCommand(commonClientFlags, clientFactory),
		createSignalServiceCommand(commonClientFlags, clientFactory),
	)
}
Beispiel #2
0
func registerDaemonCommandsAt(executableType ExecutableType, app *cli.App) {
	var name string
	switch executableType {
	case Daemon:
		name = "run"
	default:
		name = "daemon"
	}

	app.Commands = append(app.Commands, cli.Command{
		Name:            name,
		SkipFlagParsing: true,
		ArgsUsage:       "[<args pass to master service>...]",
		Usage:           "Run " + caretakerd.DaemonName + " in forground.",
		Before:          ensureDaemonConfig,
		Action: func(context *cli.Context) {
			runDaemon(*conf.instance, context.Args())
		},
		OnUsageError: onUsageErrorFor(name),
	})

}