我在主要部分使用以下脚本创建和启动服务。但是偶尔我会看到“ CPS数据服务”未运行。
任何人都可以提出原因吗?
Section "MyApp (required)"
SimpleSC::InstallService "CPS Service" "CPS Service"" "16" "2" "$INSTDIR\mainserv.exe" "" "" ""
Pop $0
SimpleSC::StartService "CPS Service" "" "30"
Pop $0
SimpleSC::InstallService "CPS Data Service" "CPS Data Service" "16" "2" "$INSTDIR\dataserv.exe" "CPS Service" "" ""
Pop $0
SimpleSC::StartService "CPS Data Service" "" "30"
Pop $0
SectionEnd
并且我在卸载时也在使用以下脚本。
最后我要停止并删除服务。是停止和删除服务的正确方法,还是我需要在终止其他进程之前执行此操作?
如果脚本中需要任何更改,也请提出建议。
Section "Uninstall"
SimpleSC::StopService "CPS Data Service"" "0" "2"
Pop $0
SimpleSC::ExistsService "CPS Data Service"
Pop $0
${If} $0 = 0
SimpleSC::RemoveService "CPS Data Service"
Pop $0
${EndIf}
SimpleSC::StopService "CPS Service" "1" "2"
Pop $0
SimpleSC::ExistsService "CPS Service"
Pop $0
${If} $0 = 0
SimpleSC::RemoveService "CPS Service"
Pop $0
${EndIf}
SectionEnd