Esempio n. 1
0
func init() {
	log.SetFlags(0)
	state.cmd = cmd.Parse()

	tmp := os.TempDir()
	key := cmd.MakeKey(state.cmd.Cmd.Name, state.cmd.Cmd.Args)
	state.globalname = filepath.Join(tmp, fmt.Sprintf("%s_global", state.cmd.Me.Name))
	state.localname = filepath.Join(tmp, fmt.Sprintf("%s_local_%s", state.cmd.Me.Name, key))
}
Esempio n. 2
0
func init() {
	log.SetFlags(0)
	state.cmd = cmd.Parse("period")

	var err error
	state.period, err = time.ParseDuration(state.cmd.Me.Args[0])
	if err != nil {
		cmd.ArgError(err)
	}
	if state.period < 0 {
		cmd.BadArgs("period must be non-negative")
	}

	tmp := os.TempDir()
	key := cmd.MakeKey(state.cmd.Cmd.Name, state.cmd.Cmd.Args)
	state.statname = filepath.Join(tmp, fmt.Sprintf("%s_%s", state.cmd.Me.Name, key))
}
Esempio n. 3
0
func init() {
	log.SetFlags(0)
	state.cmd = cmd.Parse("maxfail")

	maxfail, err := strconv.ParseInt(state.cmd.Me.Args[0], 0, 0)
	if err != nil {
		cmd.ArgError(err)
	}
	if maxfail < 1 {
		cmd.BadArgs("maxfail must be positive")
	}
	state.maxfail = int(maxfail)

	tmp := os.TempDir()
	key := cmd.MakeKey(state.cmd.Cmd.Name, state.cmd.Cmd.Args)
	state.logname = filepath.Join(tmp, fmt.Sprintf("%s_%s.log", state.cmd.Me.Name, key))
}