This repository has been archived by the owner on Feb 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add drain script for docker-windows job
- Loading branch information
Ben Moss
committed
Nov 4, 2019
1 parent
05411cd
commit 6beed01
Showing
2 changed files
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
$ErrorActionPreference = "Stop"; | ||
|
||
echo "Querying docker service" | Out-File -Encoding ASCII -Append "c:\var\vcap\sys\log\docker-windows\drain.log" | ||
$docker=(Get-Service | where { $_.Name -eq 'docker' }) | ||
if ($docker -eq $null) { | ||
echo "Docker service not found; Exiting 0" | Out-File -Encoding ASCII -Append "c:\var\vcap\sys\log\docker-windows\drain.log" | ||
"0" | ||
Exit 0 | ||
} | ||
|
||
echo "Docker service found" | Out-File -Encoding ASCII -Append "c:\var\vcap\sys\log\docker-windows\drain.log" | ||
If ($docker.Status -Eq "Running") { | ||
echo "Docker service running; Stopping" | Out-File -Encoding ASCII -Append "c:\var\vcap\sys\log\docker-windows\drain.log" | ||
Stop-Service $docker | Out-File -Encoding ASCII -Append "c:\var\vcap\sys\log\docker-windows\drain.log" | ||
} | ||
echo "Docker service drained; Exit 0" | Out-File -Encoding ASCII -Append "c:\var\vcap\sys\log\docker-windows\drain.log" | ||
|
||
"0" | ||
Exit 0 |