download and install Mongo db

# Taken from: http://blogs.msdn.com/b/daiken/archive/2007/02/12/compress-files-with-windows-powershell-then-package-a-windows-vista-sidebar-gadget.aspx
function 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 --smallfiles

Start-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
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值