Added some BEC checks.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
; wDayzManager.ini
|
||||
[Config]
|
||||
serverLocation=Z:\Servers\dayzserver
|
||||
; serverLocation=D:\dayz\server
|
||||
; serverLocation=D:\servers\dayz
|
||||
profilesLocation=profiles
|
||||
steamCMD=Z:\SteamCMD
|
||||
; steamCMD=V:\SteamCMD
|
||||
@@ -12,8 +12,7 @@ rotateLogs=1
|
||||
daysAmount=7
|
||||
rotatedLogsFolderName=RotatedLogs
|
||||
; rotatedLogsFolderName=
|
||||
becFolderName=BEC
|
||||
; becFolderName=
|
||||
becLocation=D:\servers\bec
|
||||
atFolderName=VPPAdminTools
|
||||
; atFolderName=CommunityOnlineTools
|
||||
; atFolderName=
|
||||
|
||||
@@ -107,6 +107,7 @@ $ini = (Get-IniContent -FilePath $iniFile)
|
||||
$config = $ini.Config
|
||||
[string]$serverLocation = $config.serverLocation
|
||||
[string]$profilesLocation = $config.profilesLocation
|
||||
[string]$becLocation = $config.becLocation
|
||||
[string]$steamCMD = $config.steamCMD
|
||||
[string]$steamUser = $config.steamUser
|
||||
[int]$appidGame = $config.appidGame
|
||||
@@ -246,11 +247,21 @@ if ($rotateLogs) {
|
||||
}
|
||||
}
|
||||
|
||||
if (-not ([string]::IsNullOrEmpty($config.becFolderName))) {
|
||||
$becFolderName = $config.becFolderName
|
||||
$becLocation = "$($serverLocation)\$($becFolderName)"
|
||||
# Checks for BEC location
|
||||
if (-not ([string]::IsNullOrEmpty($becLocation))) {
|
||||
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))) {
|
||||
$atFolderName = $config.atFolderName
|
||||
}
|
||||
@@ -315,8 +326,17 @@ foreach ($srv in $servers) {
|
||||
$startupParams = @("`"-profiles=$($serverProfile)`"", "`"-config=$($serverProfile)\$($serverConfig)`"", "-port=$($serverPort)", "-cpuCount=$($serverCPU)")
|
||||
$dayzArguments = $startupParams + $startupMods + $additionalParams
|
||||
$dayz = "`"$($serverLocation)\$($serverExeName)`""
|
||||
|
||||
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
|
||||
if ($rotateLogs) {
|
||||
@@ -499,14 +519,14 @@ foreach ($srv in $servers) {
|
||||
# Starting servers
|
||||
Set-Location -Path "$($serverLocation)"
|
||||
$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]
|
||||
|
||||
# Starting BEC
|
||||
if ($becLocation) {
|
||||
Set-Location -Path "$($becLocation)"
|
||||
$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]
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user