clear
#获取代码最新版本
&'C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe' /command:update /path:"D:\tujia\branches" /closeonend:1
if($?)
{
}
#编译
&'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild' D:\tujia\branches\Solution\All\All.sln /v:n
if(!$?)
{
}
#获取当前脚本路径
$CurrentScriptPath = Split-Path -Parent $MyInvocation.MyCommand.Definition
#读取后台WCF服务器地址
$path = Join-Path $CurrentScriptPath "WcfServers.txt"
$wcfServers = Get-Content -Path $path
$WcfExcludeFile = Join-Path $CurrentScriptPath "WcfExclude.txt"
#复制Wcf服务网页和程序的文件
foreach($wcfServer in $wcfServers)
{
}
#读取web服务器地址
$path = Join-Path $CurrentScriptPath "WebServers.txt"
$WebServers = Get-Content -Path $path
$WebExcludeFile = Join-Path $CurrentScriptPath "WebExclude.txt"
#复制各Web的程序和网页文件
foreach($WebServer in $WebServers)
{
}
#部署静态内容
&'c:\Windows\System32\xcopy.exe' ("D:\Tujia\branches\Projects\TuJia.Web.StaticFile") ("\\test-web-02\d$\web\Web.StaticFile") /e /y
#重启产品搜索缓存服务器
$SearchUnitCacheServer = "\\test-cache-01"
"正在重启缓存服务"
&"c:\Windows\system32\sc.exe" $SearchUnitCacheServer stop "Memcachedserver11213"
&"c:\Windows\system32\sc.exe" $SearchUnitCacheServer start "Memcachedserver11213"
"重启缓存服务完成"
#重启登录信息缓存服务器(一般情况下不用)
#&"c:\Windows\system32\sc.exe" \\vmwebedit stop "Memcachedserver11212"
#&"c:\Windows\system32\sc.exe" \\vmwebedit start "Memcachedserver11212"
#停止相关的Windows服务
"正在停止Windows服务"
$BusinessEventServer = "\\test-web-01"
$ScheduleTaskServer = "\\test-web-01"
&"c:\Windows\system32\sc.exe" $BusinessEventServer stop "TuJia Business Event"
&"c:\Windows\system32\sc.exe" $ScheduleTaskServer stop "TuJia Schedule Task"
"已停止Windows服务,请等候60秒"
#空转60秒,确保Windows服务彻底停止
ping localhost -n 60 >> null
#复制Windows的程序文件
"正在部署Windows服务"
&'c:\Windows\System32\xcopy.exe' ("D:\tujia\branches\Projects\TuJia.WindowsService.BusinessEvent\bin\Debug") ($BusinessEventServer + "\d$\WindowService\TuJia.WindowsService.BusinessEvent") /e /y
&'c:\Windows\System32\xcopy.exe' ("D:\tujia\branches\Projects\TuJia.WindowsService.ScheduleTask\bin\Debug") ($ScheduleTaskServer + "\d$\WindowService\TuJia.WindowsService.ScheduleTask") /e /y
#启动Windows服务
"正在启动Windows服务"
&"c:\Windows\system32\sc.exe"
&"c:\Windows\system32\sc.exe"
"已启动Windows服务"