Skip to content

Commit 000442b

Browse files
committed
Delete HPC node in daemon. Delete sched task on daemon exit.
1 parent 908cdbe commit 000442b

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

daemon.ps1

+17-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,20 @@ if (!$CreatedMutex) {
44
$mutex.WaitOne()
55
}
66

7-
write-output "Mutex entered. Stopping HPC Services"
7+
write-output "Mutex entered. Deleting HPC Node"
8+
9+
try {
10+
Add-PSSnapin microsoft.hpc
11+
$hstnm = hostname
12+
$node = Get-HpcNode -Name $hstnm
13+
Set-HpcNodeState -Node $node -State offline
14+
Remove-HpcNode -Node $node
15+
}
16+
catch {
17+
$_
18+
}
19+
20+
write-output "Stopping HPC Service"
821

922
# HPC Head node Service
1023
sc.exe stop HpcMonitoringServer
@@ -25,6 +38,8 @@ sc.exe stop HpcBroker
2538

2639
# Other HPC service depend on SDM
2740
sc.exe stop HpcSdm
28-
41+
42+
schtasks /delete /tn mesoshpcdaemon /f
43+
2944
$mutex.ReleaseMutex()
3045
$mutex.Close()

0 commit comments

Comments
 (0)