diff --git a/functions/process/Get-Lock.psm1 b/functions/process/Get-Lock.psm1 new file mode 100644 index 0000000..48f667c --- /dev/null +++ b/functions/process/Get-Lock.psm1 @@ -0,0 +1,11 @@ +function Get-Lock { + [CmdletBinding()] + [OutputType([boolean])] + param ( + ) + if ((Test-Path -Path ".\servers\$($Server.UID).LOCK" -PathType "Leaf" -ErrorAction SilentlyContinue)) { + return $true + } + return $false +} +Export-ModuleMember -Function Get-Lock \ No newline at end of file diff --git a/functions/process/Lock-Process.psm1 b/functions/process/Lock-Process.psm1 new file mode 100644 index 0000000..7ab39de --- /dev/null +++ b/functions/process/Lock-Process.psm1 @@ -0,0 +1,15 @@ +function Lock-Process { + [CmdletBinding()] + [OutputType([boolean])] + param ( + ) + try { + $null = New-Item -Path ".\servers\" -Name "$($Server.UID).LOCK" -ItemType "file" -Force -ErrorAction SilentlyContinue + Write-ScriptMsg "Process Locked." + } + catch { + return $false + } + return $true +} +Export-ModuleMember -Function Lock-Process \ No newline at end of file diff --git a/functions/process/Unlock-Process.psm1 b/functions/process/Unlock-Process.psm1 new file mode 100644 index 0000000..29eed90 --- /dev/null +++ b/functions/process/Unlock-Process.psm1 @@ -0,0 +1,16 @@ +function Unlock-Process { + [CmdletBinding()] + [OutputType([boolean])] + param ( + ) + try { + #Delete the LOCK file based on the Server UID. + $null = Remove-Item -Path ".\servers\$($Server.UID).LOCK" -Confirm:$false -ErrorAction SilentlyContinue + Write-ScriptMsg "Process Unlocked." + } + catch { + return $false + } + return $true +} +Export-ModuleMember -Function Unlock-Process \ No newline at end of file diff --git a/functions/server/Start-Server.psm1 b/functions/server/Start-Server.psm1 index 0475fb6..c42d4ed 100644 --- a/functions/server/Start-Server.psm1 +++ b/functions/server/Start-Server.psm1 @@ -24,6 +24,7 @@ function Start-Server { } else { $null = Set-Priority -ServerProcess $ServerProcess } + $null = Register-TaskConfig } catch { Write-Error $_ diff --git a/functions/util/Exit-WithError.psm1 b/functions/util/Exit-WithError.psm1 index 87721a7..0cc168e 100644 --- a/functions/util/Exit-WithError.psm1 +++ b/functions/util/Exit-WithError.psm1 @@ -7,6 +7,7 @@ function Exit-WithError ) #Write error in red on black, stop logging, pause, exit. Write-Host -ForegroundColor "Red" -BackgroundColor "Black" -Object $ErrorMsg + Unlock-Process Stop-Transcript if ($Global.PauseOnErrors){ Read-Host "Press Enter to close this window." diff --git a/functions/util/Get-TaskConfig.psm1 b/functions/util/Get-TaskConfig.psm1 new file mode 100644 index 0000000..d95359e --- /dev/null +++ b/functions/util/Get-TaskConfig.psm1 @@ -0,0 +1,12 @@ +function Get-TaskConfig { + Write-ScriptMsg "Getting Tasks Schedule..." + $NextAlive = Get-IniValue -file ".\servers\$($Server.UID).INI" -key "NextAlive" + $NextUpdate = Get-IniValue -file ".\servers\$($Server.UID).INI" -key "NextUpdate" + $NextRestart = Get-IniValue -file ".\servers\$($Server.UID).INI" -key "NextRestart" + return { + NextAlive: $NextAlive, + NextUpdate: $NextUpdate, + NextRestart: $NextRestart + } + } +Export-ModuleMember -Function Get-TaskConfig \ No newline at end of file diff --git a/functions/util/Register-UpdateTask.psm1 b/functions/util/Register-Task.psm1 similarity index 61% rename from functions/util/Register-UpdateTask.psm1 rename to functions/util/Register-Task.psm1 index 7230032..fc4a9fe 100644 --- a/functions/util/Register-UpdateTask.psm1 +++ b/functions/util/Register-Task.psm1 @@ -1,13 +1,13 @@ -function Register-UpdateTask { - $action = New-ScheduledTaskAction -Execute "Powershell.exe" -Argument "-WindowStyle Hidden -NoProfile -ExecutionPolicy Bypass -File $scriptpath -ServerCfg `"$ServerCfg`" -UpdateCheck" -WorkingDirectory $dir - $trigger = New-ScheduledTaskTrigger -Daily -At 12am -RandomDelay (New-TimeSpan -Minutes $Global.UpdateCheckFrequency) +function Register-Task { + $action = New-ScheduledTaskAction -Execute "Powershell.exe" -Argument "-WindowStyle Hidden -NoProfile -ExecutionPolicy Bypass -File $scriptpath -ServerCfg `"$ServerCfg`" -Task" -WorkingDirectory $dir + $trigger = New-ScheduledTaskTrigger -Daily -At 12am -RandomDelay (New-TimeSpan -Minutes $Global.TaskCheckFrequency) $settings = New-ScheduledTaskSettingsSet -ExecutionTimeLimit (New-TimeSpan -Minutes 10) - $description = "Check if updates are available for $($server.Name)" - $title = "UpdateCheck-$($server.Name)" + $description = "Run Tasks for $($server.UID)" + $title = "Tasks-$($server.UID)" $task = New-ScheduledTask -Description $description -Action $action -Trigger $trigger -Settings $settings $RegisteredTask = Register-ScheduledTask $title -InputObject $task $RegisteredTask.Triggers.Repetition.Duration = "P1D" #Repeat for a duration of one day - $RegisteredTask.Triggers.Repetition.Interval = "PT$($Global.UpdateCheckFrequency)M" #Repeat every 30 minutes, use PT1H for every hour + $RegisteredTask.Triggers.Repetition.Interval = "PT$($Global.TaskCheckFrequency)M" #Repeat every X minutes, use PT1H for every hour $null = Set-ScheduledTask $RegisteredTask } -Export-ModuleMember -Function Register-UpdateTask \ No newline at end of file +Export-ModuleMember -Function Register-Task \ No newline at end of file diff --git a/functions/util/Register-TaskConfig.psm1 b/functions/util/Register-TaskConfig.psm1 new file mode 100644 index 0000000..7b689de --- /dev/null +++ b/functions/util/Register-TaskConfig.psm1 @@ -0,0 +1,13 @@ +function Register-TaskConfig { + Write-ScriptMsg "Registering Tasks Schedule..." + try { + $null = New-Item -Path ".\servers\" -Name "$($Server.UID).INI" -ItemType "file" -Force -ErrorAction SilentlyContinue + Write-ScriptMsg "Tasks Schedule Registered." + } + catch { + return $null + } + Update-TaskConfig -Alive -Update -Restart + return $true + } +Export-ModuleMember -Function Register-TaskConfig \ No newline at end of file diff --git a/functions/util/Remove-TaskConfig.psm1 b/functions/util/Remove-TaskConfig.psm1 new file mode 100644 index 0000000..ff6457e --- /dev/null +++ b/functions/util/Remove-TaskConfig.psm1 @@ -0,0 +1,16 @@ +function Remove-TaskConfig { + [CmdletBinding()] + [OutputType([boolean])] + param ( + ) + try { + #Delete the INI file based on the Server UID. + $null = Remove-Item -Path ".\servers\$($Server.UID).INI" -Confirm:$false -ErrorAction SilentlyContinue + Write-ScriptMsg "Task Config Removed." + } + catch { + return $false + } + return $true +} +Export-ModuleMember -Function Remove-TaskConfig \ No newline at end of file diff --git a/functions/util/Unregister-Task.psm1 b/functions/util/Unregister-Task.psm1 new file mode 100644 index 0000000..f44a086 --- /dev/null +++ b/functions/util/Unregister-Task.psm1 @@ -0,0 +1,6 @@ +function Unregister-UpdateTask { + $title = "Tasks-$($server.UID)" + $null = Unregister-ScheduledTask -TaskName $title -Confirm:$false -ErrorAction SilentlyContinue + Remove-TaskConfig +} +Export-ModuleMember -Function Unregister-UpdateTask \ No newline at end of file diff --git a/functions/util/Update-TaskConfig.psm1 b/functions/util/Update-TaskConfig.psm1 new file mode 100644 index 0000000..0c4a72d --- /dev/null +++ b/functions/util/Update-TaskConfig.psm1 @@ -0,0 +1,30 @@ + +function Update-TaskConfig { + [CmdletBinding()] + param ( + [Parameter(Mandatory=$false)] + [switch]$Alive, + [Parameter(Mandatory=$false)] + [switch]$Update, + [Parameter(Mandatory=$false)] + [string]$Restart + ) + + Write-ScriptMsg "Updating Tasks Schedule..." + + if($Alive){ + $NextAlive = (Get-Date).AddMinutes($Global.AliveCheckFrequency) + Set-IniValue -file ".\servers\$($Server.UID).INI" -key "NextAlive" -value $NextAlive + } + + if($Update){ + $NextUpdate = (Get-Date).AddMinutes($Global.UpdateCheckFrequency) + Set-IniValue -file ".\servers\$($Server.UID).INI" -key "NextUpdate" -value $NextUpdate + } + + if($Restart){ + $NextRestart = (Get-Date -Hour $Server.AutoRestartTime[0] -Minute $Server.AutoRestartTime[1] -Second $Server.AutoRestartTime[2]).AddDays(1) + Set-IniValue -file ".\servers\$($Server.UID).INI" -key "NextRestart" -value $NextRestart + } + } +Export-ModuleMember -Function Update-TaskConfig \ No newline at end of file diff --git a/global.psm1 b/global.psm1 index 927e98d..dce1483 100644 --- a/global.psm1 +++ b/global.psm1 @@ -34,6 +34,12 @@ $GlobalDetails = @{ #Check for Update Frequency in Minutes UpdateCheckFrequency = 15 + + #Check if the server is alive Frequency in Minutes + AliveCheckFrequency = 5 + + #Should be lower or equal to the two above + TaskCheckFrequency = 2 } #Create the object diff --git a/main.ps1 b/main.ps1 index 783f968..1805423 100644 --- a/main.ps1 +++ b/main.ps1 @@ -7,7 +7,7 @@ param ( [Parameter(Mandatory=$true)] [string]$ServerCfg, [Parameter(Mandatory=$false)] - [switch]$UpdateCheck + [switch]$Task ) #--------------------------------------------------------- @@ -63,7 +63,12 @@ Install-Dependency Write-ScriptMsg "Importing Server Configuration..." #Check if requested config exist in the config folder, if not, copy it from the templates. Exit if fails. +#In the case of an update check or alive check, remove the check if the configuration is deleted. if (-not (Test-Path -Path ".\configs\$ServerCfg.psm1" -PathType "Leaf" -ErrorAction SilentlyContinue)) { + if($Task){ + Unregister-Task + Exit + } if (Test-Path -Path ".\templates\$ServerCfg.psm1" -PathType "Leaf" -ErrorAction SilentlyContinue){ $null = Copy-Item -Path ".\templates\$ServerCfg.psm1" -Destination ".\configs\$ServerCfg.psm1" -ErrorAction SilentlyContinue } else { @@ -82,18 +87,54 @@ catch { #Parse configuration Read-Config +#Check if script is already running +if(Get-Lock){ + exit +} -#--------------------------------------------------------- -# Checking if updates are available. -#--------------------------------------------------------- -if ($UpdateCheck) { - Write-ScriptMsg "Checking on steamCMD if updates are avaiable for $($Server.Name)..." - if (-not (Request-Update)){ - Write-ScriptMsg "No updates are available for $($Server.Name)" - Exit - } - Write-ScriptMsg "Updates are available for $($Server.Name), Proceeding with update process..." - #Run Launcher as usual if an update is required +#Locking Script to avoid double run +Lock-Process + +#--------------------------------------------------------- +# Checking Scheduled Task +#--------------------------------------------------------- +if ($Task) { + $FullRunRequired = $false + Write-ScriptMsg "Running Tasks for $($Server.UID) ..." + $TasksSchedule = Get-TaskConfig + + if(($Server.AutoRestartOnCrash) -and (($TasksSchedule.NextAlive) -lt (Get-Date))){ + Write-ScriptMsg "Checking Alive State" + if(-not (Get-ServerProcess)) { + Write-ScriptMsg "Server is Dead, Restarting..." + Update-TaskConfig -Alive + $FullRunRequired = $true + } else { + Write-ScriptMsg "Server is Alive" + } + } + + if(($Server.AutoUpdates) -and (($TasksSchedule.NextUpdate) -lt (Get-Date))){ + Write-ScriptMsg "Checking on steamCMD if updates are avaiable for $($Server.UID)..." + if (Request-Update){ + Write-ScriptMsg "Updates are available for $($Server.UID), Proceeding with update process..." + $FullRunRequired = $true + Update-TaskConfig -Update + } else { + Write-ScriptMsg "No updates are available for $($Server.UID)" + } + } + + Write-ScriptMsg "Checking if server $($Server.UID) is due for restart" + if(($Server.AutoRestart) -and (($TasksSchedule.NextRestart) -lt (Get-Date))){ + $FullRunRequired = $true + Update-TaskConfig -Restart + } + + if(-not $FullRunRequired) { + exit + } + #Run Launcher as usual } #--------------------------------------------------------- @@ -142,12 +183,12 @@ if (-not $FreshInstall -and $Server.AutoUpdates) { } #--------------------------------------------------------- -# Create Scheduled Task to monitor auto-updates +# Register Scheduled Task #--------------------------------------------------------- -if ($Server.AutoUpdates -and -not (Get-ScheduledTask -TaskName "UpdateCheck-$($server.Name)" -ErrorAction SilentlyContinue)) { - Write-ScriptMsg "Registering Update Check Scheduled Task for $($Server.Name)..." - Register-UpdateTask +if ($Server.AutoUpdates -and -not (Get-ScheduledTask -TaskName "Tasks-$($server.UID)" -ErrorAction SilentlyContinue)) { + Write-ScriptMsg "Registering Scheduled Tasks Check for $($Server.UID)..." + Register-Task } #--------------------------------------------------------- @@ -183,10 +224,17 @@ catch { Exit-WithError -ErrorMsg "Unable clean old logs." } + #--------------------------------------------------------- -# Stop Logging +# Unlock Process #--------------------------------------------------------- +Unlock-Process + Write-ServerMsg "Script successfully completed." +#--------------------------------------------------------- +# Stop Logging +#--------------------------------------------------------- + Stop-Transcript \ No newline at end of file diff --git a/templates/7daystodie.psm1 b/templates/7daystodie.psm1 index 9acd250..00e1426 100644 --- a/templates/7daystodie.psm1 +++ b/templates/7daystodie.psm1 @@ -57,6 +57,16 @@ $ServerDetails = @{ #Set to $true if you want this server to automatically update. AutoUpdates = $true + #Set to $true if you want this server to automatically restart on crash. + AutoRestartOnCrash = $true + + #Set to $true if you want this server to automatically restart at set hour. + AutoRestart = $true + + #The time at which the server will restart daily. + #(Hour, Minute, Seconds) + AutoRestartTime = @(3,0,0) + #Process name in the task manager ProcessName = "7DaysToDieServer" diff --git a/templates/astroneer.psm1 b/templates/astroneer.psm1 index b94a35d..dab058a 100644 --- a/templates/astroneer.psm1 +++ b/templates/astroneer.psm1 @@ -80,6 +80,16 @@ $ServerDetails = @{ #Set to $true if you want this server to automatically update. AutoUpdates = $true + #Set to $true if you want this server to automatically restart on crash. + AutoRestartOnCrash = $true + + #Set to $true if you want this server to automatically restart at set hour. + AutoRestart = $true + + #The time at which the server will restart daily. + #(Hour, Minute, Seconds) + AutoRestartTime = @(3,0,0) + #Process name in the task manager ProcessName = "AstroServer-Win64-Shipping" diff --git a/templates/icarus.psm1 b/templates/icarus.psm1 index 79deae4..fdf146a 100644 --- a/templates/icarus.psm1 +++ b/templates/icarus.psm1 @@ -88,6 +88,16 @@ $ServerDetails = @{ #Set to $true if you want this server to automatically update. AutoUpdates = $true + #Set to $true if you want this server to automatically restart on crash. + AutoRestartOnCrash = $true + + #Set to $true if you want this server to automatically restart at set hour. + AutoRestart = $true + + #The time at which the server will restart daily. + #(Hour, Minute, Seconds) + AutoRestartTime = @(3,0,0) + #Process name in the task manager ProcessName = "IcarusServer-Win64-Shipping" diff --git a/templates/insurgencysandstorm.psm1 b/templates/insurgencysandstorm.psm1 index b1203e5..c47d1c3 100644 --- a/templates/insurgencysandstorm.psm1 +++ b/templates/insurgencysandstorm.psm1 @@ -97,6 +97,16 @@ $ServerDetails = @{ #Set to $true if you want this server to automatically update. AutoUpdates = $true + #Set to $true if you want this server to automatically restart on crash. + AutoRestartOnCrash = $true + + #Set to $true if you want this server to automatically restart at set hour. + AutoRestart = $true + + #The time at which the server will restart daily. + #(Hour, Minute, Seconds) + AutoRestartTime = @(3,0,0) + #Process name in the task manager ProcessName = "InsurgencyServer-Win64-Shipping" diff --git a/templates/killingfloor2.psm1 b/templates/killingfloor2.psm1 index 7a30d12..a1f7771 100644 --- a/templates/killingfloor2.psm1 +++ b/templates/killingfloor2.psm1 @@ -80,6 +80,16 @@ $ServerDetails = @{ #Set to $true if you want this server to automatically update. AutoUpdates = $true + #Set to $true if you want this server to automatically restart on crash. + AutoRestartOnCrash = $true + + #Set to $true if you want this server to automatically restart at set hour. + AutoRestart = $true + + #The time at which the server will restart daily. + #(Hour, Minute, Seconds) + AutoRestartTime = @(3,0,0) + #Process name in the task manager ProcessName = "KFServer" diff --git a/templates/left4dead2.psm1 b/templates/left4dead2.psm1 index ce5cf4a..c95662e 100644 --- a/templates/left4dead2.psm1 +++ b/templates/left4dead2.psm1 @@ -72,6 +72,16 @@ $ServerDetails = @{ #Set to $true if you want this server to automatically update. AutoUpdates = $true + #Set to $true if you want this server to automatically restart on crash. + AutoRestartOnCrash = $true + + #Set to $true if you want this server to automatically restart at set hour. + AutoRestart = $true + + #The time at which the server will restart daily. + #(Hour, Minute, Seconds) + AutoRestartTime = @(3,0,0) + #Process name in the task manager ProcessName = "srcds" diff --git a/templates/mordhau.psm1 b/templates/mordhau.psm1 index 91d6ce1..7142b7a 100644 --- a/templates/mordhau.psm1 +++ b/templates/mordhau.psm1 @@ -69,6 +69,16 @@ $ServerDetails = @{ #Set to $true if you want this server to automatically update. AutoUpdates = $true + #Set to $true if you want this server to automatically restart on crash. + AutoRestartOnCrash = $true + + #Set to $true if you want this server to automatically restart at set hour. + AutoRestart = $true + + #The time at which the server will restart daily. + #(Hour, Minute, Seconds) + AutoRestartTime = @(3,0,0) + #Process name in the task manager ProcessName = "MordhauServer-Win64-Shipping" diff --git a/templates/pixark.psm1 b/templates/pixark.psm1 index 247816c..f3b281d 100644 --- a/templates/pixark.psm1 +++ b/templates/pixark.psm1 @@ -108,6 +108,16 @@ $ServerDetails = @{ #Set to $true if you want this server to automatically update. AutoUpdates = $true + #Set to $true if you want this server to automatically restart on crash. + AutoRestartOnCrash = $true + + #Set to $true if you want this server to automatically restart at set hour. + AutoRestart = $true + + #The time at which the server will restart daily. + #(Hour, Minute, Seconds) + AutoRestartTime = @(3,0,0) + #Process name in the task manager ProcessName = "PixArkServer" diff --git a/templates/projectzomboid.psm1 b/templates/projectzomboid.psm1 index 31c0590..ec4bc94 100644 --- a/templates/projectzomboid.psm1 +++ b/templates/projectzomboid.psm1 @@ -79,6 +79,16 @@ $ServerDetails = @{ #Set to $true if you want this server to automatically update. AutoUpdates = $true + #Set to $true if you want this server to automatically restart on crash. + AutoRestartOnCrash = $true + + #Set to $true if you want this server to automatically restart at set hour. + AutoRestart = $true + + #The time at which the server will restart daily. + #(Hour, Minute, Seconds) + AutoRestartTime = @(3,0,0) + #Process name in the task manager ProcessName = "java" diff --git a/templates/rust.psm1 b/templates/rust.psm1 index 42a6a4a..57c9469 100644 --- a/templates/rust.psm1 +++ b/templates/rust.psm1 @@ -114,6 +114,16 @@ $ServerDetails = @{ #Set to $true if you want this server to automatically update. AutoUpdates = $true + #Set to $true if you want this server to automatically restart on crash. + AutoRestartOnCrash = $true + + #Set to $true if you want this server to automatically restart at set hour. + AutoRestart = $true + + #The time at which the server will restart daily. + #(Hour, Minute, Seconds) + AutoRestartTime = @(3,0,0) + #Process name in the task manager ProcessName = "RustDedicated" diff --git a/templates/satisfactory.psm1 b/templates/satisfactory.psm1 index dcc18c6..88ff190 100644 --- a/templates/satisfactory.psm1 +++ b/templates/satisfactory.psm1 @@ -63,6 +63,16 @@ $ServerDetails = @{ #Set to $true if you want this server to automatically update. AutoUpdates = $true + #Set to $true if you want this server to automatically restart on crash. + AutoRestartOnCrash = $true + + #Set to $true if you want this server to automatically restart at set hour. + AutoRestart = $true + + #The time at which the server will restart daily. + #(Hour, Minute, Seconds) + AutoRestartTime = @(3,0,0) + #Process name in the task manager ProcessName = "UE4Server-Win64-Shipping" diff --git a/templates/squad.psm1 b/templates/squad.psm1 index ea3edd6..969a0fc 100644 --- a/templates/squad.psm1 +++ b/templates/squad.psm1 @@ -62,6 +62,16 @@ $ServerDetails = @{ #Set to $true if you want this server to automatically update. AutoUpdates = $true + #Set to $true if you want this server to automatically restart on crash. + AutoRestartOnCrash = $true + + #Set to $true if you want this server to automatically restart at set hour. + AutoRestart = $true + + #The time at which the server will restart daily. + #(Hour, Minute, Seconds) + AutoRestartTime = @(3,0,0) + #Process name in the task manager ProcessName = "SquadGameServer" diff --git a/templates/starbound.psm1 b/templates/starbound.psm1 index 3d692e1..9352d36 100644 --- a/templates/starbound.psm1 +++ b/templates/starbound.psm1 @@ -52,6 +52,16 @@ $ServerDetails = @{ #Set to $true if you want this server to automatically update. AutoUpdates = $true + #Set to $true if you want this server to automatically restart on crash. + AutoRestartOnCrash = $true + + #Set to $true if you want this server to automatically restart at set hour. + AutoRestart = $true + + #The time at which the server will restart daily. + #(Hour, Minute, Seconds) + AutoRestartTime = @(3,0,0) + #Process name in the task manager ProcessName = "starbound_server" diff --git a/templates/stationeers.psm1 b/templates/stationeers.psm1 index 15e64d0..db45a61 100644 --- a/templates/stationeers.psm1 +++ b/templates/stationeers.psm1 @@ -88,6 +88,16 @@ $ServerDetails = @{ #Set to $true if you want this server to automatically update. AutoUpdates = $true + #Set to $true if you want this server to automatically restart on crash. + AutoRestartOnCrash = $true + + #Set to $true if you want this server to automatically restart at set hour. + AutoRestart = $true + + #The time at which the server will restart daily. + #(Hour, Minute, Seconds) + AutoRestartTime = @(3,0,0) + #Process name in the task manager ProcessName = "rocketstation_DedicatedServer" diff --git a/templates/theforest.psm1 b/templates/theforest.psm1 index 4a9bf0d..4f654e3 100644 --- a/templates/theforest.psm1 +++ b/templates/theforest.psm1 @@ -87,6 +87,16 @@ $ServerDetails = @{ #Set to $true if you want this server to automatically update. AutoUpdates = $true + #Set to $true if you want this server to automatically restart on crash. + AutoRestartOnCrash = $true + + #Set to $true if you want this server to automatically restart at set hour. + AutoRestart = $true + + #The time at which the server will restart daily. + #(Hour, Minute, Seconds) + AutoRestartTime = @(3,0,0) + #Process name in the task manager ProcessName = "TheForestDedicatedServer" diff --git a/templates/valheim.psm1 b/templates/valheim.psm1 index b5ef747..65b68ea 100644 --- a/templates/valheim.psm1 +++ b/templates/valheim.psm1 @@ -59,6 +59,16 @@ $ServerDetails = @{ #Set to $true if you want this server to automatically update. AutoUpdates = $true + #Set to $true if you want this server to automatically restart on crash. + AutoRestartOnCrash = $true + + #Set to $true if you want this server to automatically restart at set hour. + AutoRestart = $true + + #The time at which the server will restart daily. + #(Hour, Minute, Seconds) + AutoRestartTime = @(3,0,0) + #Process name in the task manager ProcessName = "valheim_server" diff --git a/templates/valheim_plus.psm1 b/templates/valheim_plus.psm1 index ca72f38..f6d5f01 100644 --- a/templates/valheim_plus.psm1 +++ b/templates/valheim_plus.psm1 @@ -62,6 +62,16 @@ $ServerDetails = @{ #Set to $true if you want this server to automatically update. AutoUpdates = $true + #Set to $true if you want this server to automatically restart on crash. + AutoRestartOnCrash = $true + + #Set to $true if you want this server to automatically restart at set hour. + AutoRestart = $true + + #The time at which the server will restart daily. + #(Hour, Minute, Seconds) + AutoRestartTime = @(3,0,0) + #Process name in the task manager ProcessName = "valheim_server" diff --git a/templates/vrising.psm1 b/templates/vrising.psm1 index 864be68..1a7510d 100644 --- a/templates/vrising.psm1 +++ b/templates/vrising.psm1 @@ -53,6 +53,16 @@ $ServerDetails = @{ #Set to $true if you want this server to automatically update. AutoUpdates = $true + #Set to $true if you want this server to automatically restart on crash. + AutoRestartOnCrash = $true + + #Set to $true if you want this server to automatically restart at set hour. + AutoRestart = $true + + #The time at which the server will restart daily. + #(Hour, Minute, Seconds) + AutoRestartTime = @(3,0,0) + #Process name in the task manager ProcessName = "vrisingserver"