コード例 #1
0
func getCMSWebPath(cmdLine string) (string, error) {
	result := utils.GetFileDir(utils.GetFileDir(cmdLine))
	if utils.IsEmptyStr(result) {
		return result, errors.New("不是正确的中心管理服务器路径")
	}
	return result, nil
}
コード例 #2
0
func (restartProcessByServerInfoLinuxCommon *restartProcessByServerInfoLinuxCommon) Restart(serverInfo *model.ServerInfo) error {
	if common.SERVER_TYPE_CMS == serverInfo.Type {
		return errors.New("不支持的类型")
	}
	cmdLine := serverInfo.Address
	err := NewExecuteLinuxProc().Exec(cmdLine, utils.GetFileDir(cmdLine))
	if nil != err {
		return err
	}
	if !processHandleTimerFunc(cmdLine, 15, &processTimerFuncHandleRestartProc{}) {
		return errors.New(fmt.Sprintf("无法启动服务器%s程序", serverInfo.ServerName))
	}
	return nil
}
コード例 #3
0
func (serverConfigSaveHandleAPSImpl *serverConfigSaveHandleAPSImpl) Save(r *http.Request, serverInfo *model.ServerInfo) error {
	if nil == r {
		return errors.New("没有请求")
	}
	setupInfo, err := NewGetServerDetailSetupInfo().GetInfo(serverInfo)
	if nil != err {
		return err
	}
	apsSetupInfo := setupInfo.(*model.APSServerSetupInfo)
	apsSetupInfo.APSInfo.Id = r.FormValue("serverId")
	apsSetupInfo.APSInfo.Password = r.FormValue("password")
	apsSetupInfo.APSInfo.RegisterInterval, err = strconv.Atoi(r.FormValue("registerInterval"))
	if nil != err {
		return err
	}
	apsSetupInfo.APSInfo.DefaultHeartInterval, err = strconv.Atoi(r.FormValue("defaultHeartInterval"))
	if nil != err {
		return err
	}
	apsSetupInfo.APSInfo.AddressInfo.IP = r.FormValue("address")
	apsSetupInfo.APSInfo.AddressInfo.Port, err = strconv.Atoi(r.FormValue("port"))
	if nil != err {
		return err
	}
	apsSetupInfo.APSInfo.LogInfo.Logcfgfile = r.FormValue("logcfgfile")
	if utils.IsEmptyStr(apsSetupInfo.APSInfo.LogInfo.Logcfgfile) {
		return errors.New("没有日志配置文件")
	}
	if !utils.IsFileExist(utils.GetFileDir(serverInfo.Address) + "/" + apsSetupInfo.APSInfo.LogInfo.Logcfgfile) {
		return errors.New("日志配置文件不存在")
	}
	apsSetupInfo.APSInfo.LogInfo.SaveCatalog = r.FormValue("saveCatalog")
	apsSetupInfo.SipServerInfo.Id = r.FormValue("sipServerId")
	apsSetupInfo.SipServerInfo.Domain = r.FormValue("sipServerDomain")
	apsSetupInfo.SipServerInfo.AddressInfo.IP = r.FormValue("sipServerAddress")
	apsSetupInfo.SipServerInfo.AddressInfo.Port, err = strconv.Atoi(r.FormValue("sipServerPort"))
	if nil != err {
		return err
	}
	apsSetupInfo.CMSServerInfo.Address = r.FormValue("cmsServerAddress")
	cfgFileName, err := NewGetServerInfoConfigFileName().GetInfo(serverInfo)
	if nil != err {
		return err
	}
	err = setup.NewSetupInfoService().SaveSetupInfo(apsSetupInfo, cfgFileName, common.XML_ENCODE_GB2312)
	return err

}