GETENV_PARAM tmp prospero_root_script
clear_param empty
IF VAL1=$(tmp) VAL2=$(empty) STRATEGY=ELSE_END
ELSE
* calc_param _ANALIZ_BIN $(tmp)\Namechecking\p.Secco processing nodes\std.oracle\lexEngine
END

calc_param dir $(_ANALIZ_BIN)\AnalizServices\lexEngineService


PWD $(system32)\local.pwd
echo --point0-----
PLUGIN LOAD MODELER $(bin)\analiz2Licensing.dll
echo --point1-----
PLUGIN LOAD MODELER $(bin)\xp_FastCompareEngine.dll
echo --point2-----
PLUGIN LOAD MODELER $(bin)\FinasComponent.dll
echo --point3----

calc_param service_family finnovaReleaseServ
clear_param empty
i $(bin)\AnalizServices\init.rc
i $(_ANALIZ_BIN)\common_rc\lua\init.rc



##LUA_EXECUTE_FILE lua $(lua_analiz_libs)\analiz\init_dt.lua
##LUA_EXECUTE_FILE lua $(lua_analiz_libs)\analiz\TimeServ.lua
##LUA_EXECUTE_FILE lua $(lua_analiz_libs)\analiz\pwdServ.lua
##LUA_EXECUTE_FILE lua $(lua_analiz_libs)\analiz\serv.lua
##LUA_EXECUTE_FILE lua $(lua_analiz_libs)\analiz\oracleMQ.lua
##LUA_EXECUTE_FILE lua $(lua_analiz_libs)\analiz\CompactLog2.lua

##LUA_EXECUTE_FILE lua $(dir)\lua\servv.lua
##LUA_EXECUTE_FILE lua $(dir)\lua\serv.lua


##LUA_EXECUTE_FILE lua $(dir)\lua\finasServ.lua

##LUA_EXECUTE_FILE lua $(dir)\..\global_setting.lua

ORACLE_MQ_LUA_REG lua_engine


##i $(dir)\..\serv\ora_init.rc
##LUA_EXECUTE_FILE lua $(dir)\lua\mtParser.lua
##LUA_EXECUTE_FILE lua $(dir)\lua\finnova_serv.lua
##LUA_EXECUTE_FILE lua $(dir)\..\serv\lua\serv_oracle.lua

include $(dir)\log_level_setting.rc

calc_param service_name_short $(UNIQUE_IDENTIFIER)
GET_CURRENT_PROCESS_ID pid


calc_param dir $(bin)\AnalizServices\lexEngineService
calc_param log_prefix $(UNIQUE_IDENTIFIER)
calc_param service_name_short $(UNIQUE_IDENTIFIER)





LUA_EXECUTE_BLOCK_BEGIN lua

  local ss = analiz.libs.serv

  local is_service = analiz:get("_IS_SERVICE")=="1"

  local family_tag = analiz:get("UNIQUE_IDENTIFIER")



 if is_service then
   analiz:set("prospero_temp",GetRootTempDir())
   analiz:execute("calc_param txm_temp_root_dir $(prospero_temp)")
--   analiz:execute("calc_param txm_temp_root_dir $(temp)")
   analiz:execute("echo FORCEDIRECTORIES $(txm_temp_root_dir)\\lex\\$(service_family)\\$(service_name_short)")
   analiz:execute("FORCEDIRECTORIES $(txm_temp_root_dir)\\lex\\$(service_family)\\$(service_name_short)")
   analiz:execute("calc_param LOG_FORMAT $(txm_temp_root_dir)\\lex\\$(service_family)\\$(service_name_short)\\log.log")

   analiz:execute("calc_param LOG_FORMAT_dir $(txm_temp_root_dir)\\lex\\$(service_family)\\$(service_name_short)")

   analiz:execute("echo !2! FORCEDIRECTORIES $(LOG_FORMAT_dir)")
   analiz:execute("FORCEDIRECTORIES $(LOG_FORMAT_dir)")
   analiz:execute("calc_param LOG_FORMAT_t $(LOG_FORMAT_dir)")


   analiz:set("LOG_FORMAT",analiz:get("LOG_FORMAT_t").."\\log_$(DATE_FOR_LOG_FILE).log")

   local m =  analiz:map_new("log_map")
   analiz:execute("calc_param start_dt $(now)")

   m:set("start_dt",analiz:get("tmp"))
   m:set("pid",analiz:get("PID"))
   m:set("UNIQUE_IDENTIFIER",analiz:get("UNIQUE_IDENTIFIER"))
   m:set("SERVICE_NAME",analiz:get("SERVICE_NAME"))  

   analiz:execute("calc_formula_int SizePiecesM 5*1024")
   analiz:execute("echo CREATE_LOG_CIRCULAR_FILE clog $(LOG_FORMAT) $(SizePiecesM) 5 1 log_map")
   analiz:execute("echo USE_LOG clog STD")
   analiz:execute(" echo USE_LOG clog error")
   analiz:execute("CHANGE_SERVICE_LOG_PARAM LOG_FORMAT")
 end   

LUA_END

echo $(new_line)$(new_line)$(new_line)$(new_line)$(new_line)$(new_line)start service:$(UNIQUE_IDENTIFIER). $(now)
echo -----------------------------------------------------------------------------------------
echo -----------------------------------------------------------------------------------------
echo -----------------------------------------------------------------------------------------
echo -----------------------------------------------------------------------------------------
echo start $(service_family):$(UNIQUE_IDENTIFIER)
echo pid=$(pid)
echo host:$(COMPUTERNAME)
echo $(new_line)$(new_line)$(new_line)


##LUA_EXECUTE_FILE lua $(dir)\..\namechecking_finnova_releaseServ.lua

LUA_EXECUTE_BLOCK_BEGIN lua
 local ss = analiz.libs.serv
 deadline = CreateDeadlineEngineForX("release")
 ss.e("ANALIZ_SAFE_EXECUTE ret emessage LUA_EXECUTE_FILE lua $(dir)\\..\\namechecking_finnova_releaseServ.lua")
 deadline:Finish()
LUA_END

LUA_EXECUTE_LINE lua Check_and_fix_lua_failed(analiz:get("emessage"))

IF VAL1=$(emessage) VAL2=$(empty) STRATEGY=ELSE_END
ELSE
- LUA_EXECUTE_LINE lua deadline:Finish()
- SLEEP sec 15
- LUA_EXECUTE_LINE lua go_pskill()
END
