Example #1
0
// ジョブネットワークの再実行開始処理
func (n *Network) resume() error {
	timeout := config.Job.DefaultTimeoutMin * 60 * 1000
	if timeout <= 0 {
		timeout = 60000
	}

	err := n.globalLock.Lock(timeout)
	if err != nil {
		if err != util.ErrBusy {
			return err
		}
		return fmt.Errorf("Lock Timeout.")
	}
	defer n.globalLock.Unlock()

	n.Result, err = tx.ResumeJobNetwork(n.ID, config.DB.DBFile)
	if err != nil {
		return err
	}

	message.AddSysValue(`JOBNET`, `ID`, strconv.Itoa(n.ID))
	message.AddSysValue(`JOBNET`, `SD`, n.Result.JobnetResult.StartDate)

	return nil
}
Example #2
0
File: main.go Project: unikk/cuto
func realMain(args *arguments) int {
	if args.v {
		showVersion()
		return rc_OK
	}
	message.ServantVersion = Version

	// システム変数のセット
	message.AddSysValue("ROOT", "", util.GetRootPath())

	config.ReadConfig(args.configPath)
	if err := config.Servant.DetectError(); err != nil {
		console.Display("CTS005E", err)
		return rc_error
	}

	// ログ出力開始
	if err := log.Init(config.Servant.Dir.LogDir,
		"servant",
		strconv.Itoa(config.Servant.Sys.BindPort),
		config.Servant.Log.OutputLevel,
		config.Servant.Log.MaxSizeKB,
		config.Servant.Log.MaxGeneration,
		config.Servant.Log.TimeoutSec); err != nil {
		console.Display("CTS023E", err)
		return rc_error
	}
	defer log.Term()
	console.Display("CTS001I", os.Getpid(), Version)

	// メイン処理開始
	exitCode, err := Run()

	if err != nil {
		log.Error(err)
		exitCode = rc_error
	}
	console.Display("CTS002I", exitCode)
	return exitCode
}