download and install Mongo db

来源:互联网 发布:绿茶软件园源码 编辑:程序博客网 时间:2024/06/07 10:59
# Taken from: http://blogs.msdn.com/b/daiken/archive/2007/02/12/compress-files-with-windows-powershell-then-package-a-windows-vista-sidebar-gadget.aspxfunction Extract-Zip{param([string]$zipfilename, [string] $destination)if(test-path($zipfilename)){$shellApplication = new-object -com shell.application$zipPackage = $shellApplication.NameSpace($zipfilename)$destinationFolder = $shellApplication.NameSpace($destination)$destinationFolder.CopyHere($zipPackage.Items())}}$client = New-Object System.Net.Webclient$client.DownloadFile("http://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2.2.0-rc2.zip", "c:\mongo.zip")Extract-Zip "c:\mongo.zip" "c:\"Rename-Item "C:\mongodb-win32-x86_64-2.2.0-rc2" "C:\mongodb"if (!(Test-Path c:\MongoDBData)) {New-Item -Type directory c:\MongoDBData}&c:\mongodb\bin\mongod.exe --dbpath=c:\MongoDBData --install --master --noprealloc --smallfilesStart-Service -Name "MongoDB"del "C:\mongo.zip"$client.DownloadFile("http://gist.github.com/raw/633137/55e4681c4cfd3ba42b7bef71c3525697900c6906/purge_old_groups_index.js", "c:\mongodb\purge_old_groups_index.js")$sch = (&schtasks /Query /TN "Purge old groups and reindex MongoDB")if($sch -eq $null) {&schtasks.exe /create /sc DAILY /tn "Purge old groups and reindex MongoDB" /tr "c:\mongodb\bin\mongo.exe GroupsTempData c:\mongodb\purge_old_groups_index.js" /st "01:30"}

0 0
原创粉丝点击