cmd

package
v0.0.0-...-d2b7790 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StartCommand = &cli.Command{
	Name:  "start",
	Usage: "start rogue finder-web server",
	Flags: []cli.Flag{
		&cli.BoolFlag{Name: "daemon", Value: false, Usage: "run rogue finder-web in background"},
	},
	Action: func(ctx *cli.Context) error {
		defer func() {
			for _, err := range self.RunClearFuncs() {
				log.Printf("[E] Run clear funcs: %v", err)
			}
		}()

		if isDaemon := ctx.Bool("daemon"); isDaemon {
			if err := procutil.RunInBackground(runutil.ExecutableName, []string{"start"}, nil, nil); err != nil {
				log.Fatalf("[F] Run app in background failure, nest error: %v", err)
			}
			return nil
		}
		if err := setupConfig(); err != nil {
			return err
		}

		setGlobalVars()

		if err := runServer(); err != nil {
			return err
		}
		procutil.WaitForSigterm()
		return nil
	},
}
View Source
var StopCommand = &cli.Command{
	Name:  "stop",
	Usage: "stop finder-web server",
	Action: func(ctx *cli.Context) error {
		var pidFile = filepath.Join(runutil.ExecutableDir, "../var/run/rogue-finder-web.pid")
		process, err := procutil.FindWithPidFile(pidFile)
		if err != nil {
			return err
		} else {
			if err := process.Signal(syscall.SIGQUIT); err != nil {
				return nil
			}
		}
		return nil
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL