注意 要承载相同的故障转移群集上的多个高可用性 FTP 站点,请按照相同前面提到的步骤。 如果您确实不自定义脚本,您可以指向所有 FTP 站点的群集上相同的脚本文件。 但是,如果进行了特定于单个 FTP 站点更改为每个 FTP 站点和不同的群集共享的存储使用不同的脚本文件。 渚嬪 %systemroot%\System32\Inetsrv 中的第一个 FTP 站点 Clftp7 2.vbs 的第二个 Clftp7 3.vbs 对于该绗使用 Clusftp7.vbs 等等。 Each script file monitors a different FTP site.
'This script provides high availability for IIS FTP websites
'The script is applicable to:
' - Windows Server 2008: Microsoft FTP Service 7.5 for IIS 7.0 (available for download from microsoft.com)
' - Windows Server 2008 R2: FTP Service in the box
'More thorough and application-specific health monitoring logic can be added to the script if needed
Option Explicit
'Helper script functions
'Start the FTP service on this node
Function StartFTPSVC()
Dim objWmiProvider
Dim objService
Dim strServiceState
Dim response
'Check to see if the service is running
set objWmiProvider = GetObject("winmgmts:/root/cimv2")
set objService = objWmiProvider.get("win32_service='ftpsvc'")
strServiceState = objService.state
If ucase(strServiceState) = "RUNNING" Then
StartFTPSVC = True
Else
'If the service is not running, try to start it
response = objService.StartService()
'response = 0 or 10 indicates that the request to start was accepted
If ( response 0 ) and ( response 10 ) Then
StartFTPSVC = False
Else
StartFTPSVC = True
End If
End If
End Function
'Cluster resource entry points. More details here:
'http://msdn.microsoft.com/en-us/library/aa372846(VS.85).aspx
'Cluster resource Online entry point
'Make sure the FTP service is started
Function Online( )
Dim bOnline
'Make sure FTP service is started
bOnline = StartFTPSVC()
If bOnline True Then
Resource.LogInformation "The resource failed to come online because ftpsvc could not be started."
Online = False
Exit Function
End If
Online = true
End Function
'Cluster resource offline entry point
'On offline, do nothing.
Function Offline( )
Offline = true
End Function
'Cluster resource LooksAlive entry point
'Check for the state of the FTP service
Function LooksAlive( )
Dim objWmiProvider
Dim objService
Dim strServiceState
set objWmiProvider = GetObject("winmgmts:/root/cimv2")
set objService = objWmiProvider.get("win32_service='ftpsvc'")
strServiceState = objService.state
if ucase(strServiceState) = "RUNNING" Then
LooksAlive = True
Else
LooksAlive = False
End If
End Function
'Cluster resource IsAlive entry point
'Do the same health checks as LooksAlive
'If a more thorough than what we do in LooksAlive is required, this should be performed here
Function IsAlive()
IsAlive = LooksAlive
End Function
'Cluster resource Open entry point
Function Open()
Open = true
End Function
'Cluster resource Close entry point
Function Close()
Close = true
End Function
'Cluster resource Terminate entry point
Function Terminate()
Terminate = true
End Function