forked from lukebakken/rabbitmq-dotnet-client-1367
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstop-rabbitmq.ps1
34 lines (28 loc) · 878 Bytes
/
stop-rabbitmq.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
$ProgressPreference = 'Continue'
$ErrorActionPreference = 'Stop'
Set-StrictMode -Version 2.0
New-Variable -Name curdir -Option Constant `
-Value (Split-Path -Parent $MyInvocation.MyCommand.Definition)
Write-Host "[INFO] script directory: $curdir"
New-Variable -Name rabbitmq_version -Option Constant -Value '3.12.2'
$rabbitmq_dir = Join-Path -Path $curdir -ChildPath "rabbitmq_server-$rabbitmq_version"
$rabbitmq_sbin = Join-Path -Path $rabbitmq_dir -ChildPath 'sbin'
$rabbitmqctl_cmd = Join-Path -Path $rabbitmq_sbin -ChildPath 'rabbitmqctl.bat'
$rabbitmq_base = Join-Path -Path $curdir -ChildPath 'rmq'
try
{
$env:RABBITMQ_BASE = $rabbitmq_base
try
{
$ErrorActionPreference = 'Continue'
& $rabbitmqctl_cmd shutdown
}
finally
{
$ErrorActionPreference = 'Stop'
}
}
finally
{
Remove-Item -Path env:\RABBITMQ_BASE
}