Added some BEC checks.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
; wDayzManager.ini
|
; wDayzManager.ini
|
||||||
[Config]
|
[Config]
|
||||||
serverLocation=Z:\Servers\dayzserver
|
serverLocation=Z:\Servers\dayzserver
|
||||||
; serverLocation=D:\dayz\server
|
; serverLocation=D:\servers\dayz
|
||||||
profilesLocation=profiles
|
profilesLocation=profiles
|
||||||
steamCMD=Z:\SteamCMD
|
steamCMD=Z:\SteamCMD
|
||||||
; steamCMD=V:\SteamCMD
|
; steamCMD=V:\SteamCMD
|
||||||
@@ -12,8 +12,7 @@ rotateLogs=1
|
|||||||
daysAmount=7
|
daysAmount=7
|
||||||
rotatedLogsFolderName=RotatedLogs
|
rotatedLogsFolderName=RotatedLogs
|
||||||
; rotatedLogsFolderName=
|
; rotatedLogsFolderName=
|
||||||
becFolderName=BEC
|
becLocation=D:\servers\bec
|
||||||
; becFolderName=
|
|
||||||
atFolderName=VPPAdminTools
|
atFolderName=VPPAdminTools
|
||||||
; atFolderName=CommunityOnlineTools
|
; atFolderName=CommunityOnlineTools
|
||||||
; atFolderName=
|
; atFolderName=
|
||||||
|
|||||||
@@ -107,6 +107,7 @@ $ini = (Get-IniContent -FilePath $iniFile)
|
|||||||
$config = $ini.Config
|
$config = $ini.Config
|
||||||
[string]$serverLocation = $config.serverLocation
|
[string]$serverLocation = $config.serverLocation
|
||||||
[string]$profilesLocation = $config.profilesLocation
|
[string]$profilesLocation = $config.profilesLocation
|
||||||
|
[string]$becLocation = $config.becLocation
|
||||||
[string]$steamCMD = $config.steamCMD
|
[string]$steamCMD = $config.steamCMD
|
||||||
[string]$steamUser = $config.steamUser
|
[string]$steamUser = $config.steamUser
|
||||||
[int]$appidGame = $config.appidGame
|
[int]$appidGame = $config.appidGame
|
||||||
@@ -246,11 +247,21 @@ if ($rotateLogs) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (-not ([string]::IsNullOrEmpty($config.becFolderName))) {
|
# Checks for BEC location
|
||||||
$becFolderName = $config.becFolderName
|
if (-not ([string]::IsNullOrEmpty($becLocation))) {
|
||||||
$becLocation = "$($serverLocation)\$($becFolderName)"
|
if (-not [System.IO.Path]::IsPathRooted($becLocation)) {
|
||||||
|
$becLocation = "$($serverLocation)\$($becLocation)"
|
||||||
|
}
|
||||||
|
$becLocation = [System.IO.Path]::GetFullPath($becLocation)
|
||||||
|
$becFolderName = Split-Path -Path $becLocation -Leaf
|
||||||
|
|
||||||
|
if (-not (Test-Path -Path "$($becLocation)\")) {
|
||||||
|
New-Item -ItemType Directory -Path "$($becLocation)\" | Out-Null
|
||||||
|
New-Item -ItemType Directory -Path "$($becLocation)\Config\" | Out-Null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Checks for AdminTool folder name
|
||||||
if (-not ([string]::IsNullOrEmpty($config.atFolderName))) {
|
if (-not ([string]::IsNullOrEmpty($config.atFolderName))) {
|
||||||
$atFolderName = $config.atFolderName
|
$atFolderName = $config.atFolderName
|
||||||
}
|
}
|
||||||
@@ -315,8 +326,17 @@ foreach ($srv in $servers) {
|
|||||||
$startupParams = @("`"-profiles=$($serverProfile)`"", "`"-config=$($serverProfile)\$($serverConfig)`"", "-port=$($serverPort)", "-cpuCount=$($serverCPU)")
|
$startupParams = @("`"-profiles=$($serverProfile)`"", "`"-config=$($serverProfile)\$($serverConfig)`"", "-port=$($serverPort)", "-cpuCount=$($serverCPU)")
|
||||||
$dayzArguments = $startupParams + $startupMods + $additionalParams
|
$dayzArguments = $startupParams + $startupMods + $additionalParams
|
||||||
$dayz = "`"$($serverLocation)\$($serverExeName)`""
|
$dayz = "`"$($serverLocation)\$($serverExeName)`""
|
||||||
$bec = "`"$($becLocation)\bec.exe`""
|
|
||||||
$becArguments = "-f `"$($instance).cfg`" --dsc"
|
if ($becLocation) {
|
||||||
|
if (-not (Test-Path -Path "$($becLocation)\Config\$($instance).cfg")) {
|
||||||
|
New-Item -ItemType File -Path "$($becLocation)\Config\$($instance).cfg" | Out-Null
|
||||||
|
Write-Warning "Please make shure the config file `"$($instance).cfg`" in `"$($becLocation)\Config\`" folder is valid!"
|
||||||
|
Exit
|
||||||
|
}
|
||||||
|
|
||||||
|
$bec = "`"$($becLocation)\bec.exe`""
|
||||||
|
$becArguments = "-f `"$($instance).cfg`" --dsc"
|
||||||
|
}
|
||||||
|
|
||||||
# Rotate logs
|
# Rotate logs
|
||||||
if ($rotateLogs) {
|
if ($rotateLogs) {
|
||||||
@@ -499,14 +519,14 @@ foreach ($srv in $servers) {
|
|||||||
# Starting servers
|
# Starting servers
|
||||||
Set-Location -Path "$($serverLocation)"
|
Set-Location -Path "$($serverLocation)"
|
||||||
$dayzProcess[$processID] = Start-Process -FilePath $dayz -ArgumentList $dayzArguments -PassThru
|
$dayzProcess[$processID] = Start-Process -FilePath $dayz -ArgumentList $dayzArguments -PassThru
|
||||||
# Write-Host "$($dayzProcess[$processID]) = Start-Process -FilePath $($dayz) -ArgumentList $($dayzArguments) -PassThru"
|
# Write-Host "Start-Process -FilePath $($dayz) -ArgumentList $($dayzArguments) -PassThru"
|
||||||
# $dayzProcess[$processID]
|
# $dayzProcess[$processID]
|
||||||
|
|
||||||
# Starting BEC
|
# Starting BEC
|
||||||
if ($becLocation) {
|
if ($becLocation) {
|
||||||
Set-Location -Path "$($becLocation)"
|
Set-Location -Path "$($becLocation)"
|
||||||
$becProcess[$processID] = Start-Process -FilePath $bec -ArgumentList $becArguments -PassThru
|
$becProcess[$processID] = Start-Process -FilePath $bec -ArgumentList $becArguments -PassThru
|
||||||
# Write-Host "$($becProcess[$processID]) = Start-Process -FilePath $($bec) -ArgumentList $($becArguments) -PassThru"
|
# Write-Host "Start-Process -FilePath $($bec) -ArgumentList $($becArguments) -PassThru"
|
||||||
# $becProcess[$processID]
|
# $becProcess[$processID]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user