Tired of that unknown mod crashing your server while in raid? Well say no more! This PowerShell script will automatically restart the server to save your raid!
SPT-Server-Monitor
=================
Launches, monitors, relaunches if crashed, and restarts your server on any time zone you want. Please keep in mind that you will have to edit the script a bit and having some experience with scripting/coding is necessary. I highly recommend Visual Studio or NotePad++.
DOES NOT display what mod crashed your server.
Huge shoutout to Ekuland and Shynd for helping me out with minor problems! Much appreciated!
Also, please note that this PowerShell script is completely open source, and I will NOT ask you why you want to know something about the script. Although very simple I do believe in the actual meaning behind open source. Although you may be asked questions on why you want to know something about an open-source project elsewhere *cough* I will not question you in your motives as this is mine and I make the rules for whatever I make. Enjoy a COMPLETELY OPEN-SOURCE script free of charge and without question. Some people need to understand the true definition of open-source software. Being selfish over something you claim to be open-source makes it not open-source. All I ask is that if you make any changes and publish them, please give me credit as I spent two painful hours trying to get PowerShell to do what I wanted.
=================================================================
Instructions on how to use the script are on my github.
=================================================================
What It Does:
===========
- Launches the server in High Priority mode
- Monitors to see if the server is open or not
- Relaunches the server if the server has crashed
- Restarts the server daily at 12 AM EST
Reason for Script:
Some mods have the habit of crashing the server randomly, especially during a raid, so this is a safeguard to prevent the server from completely dying during your raid. It will allow you to extract, save your gear, then figure out what mod is crashing your server.
The automated restart is for those who like to keep the server open.
Notes from Revin:
This script is still under development, and I am open to any suggestions that you all may have, and I will consider each and every one one of them if they're possible. I will be adding new things to it in the future, and I really hope that this mod helps you all out! Thank you for the support and may you all have a wonderful and blessed day.
Currently working on:
Turning this into an executable, like SVM, that can be ran without the need of the script. I am also adding cool little features to it.
882 Downloads
v1.01.2 Changes:
- "Log-CrashTime" function now accepts a reason parameter, which includes the reason for the crash.
- The "Monitor-Program" function captures any errors when trying to retrieve the process and logs those errors if the process is not found. This way, the log file will include both the timestamp and the reason for each crash. This, however, will not tell you what mod potentially crashed your server. It will explain other reasonings as to why it crashed.
360 Downloads
v1.01.1 Changes:
Changes and Fixes:
- Corrected Priority Setting Ensured the priority is set to High using [System.Diagnostics.ProcessPriorityClass]::High.
- Improved Time Zone Handling. Used a try-catch block to handle invalid time zone IDs gracefully.
- Monitoring in a Separate Session:
- Corrected the arguments for Start-Process to ensure the monitoring script starts correctly in a new PowerShell window.
- Ensured the Main Script Exits If Program Already Running. Checked for existing instances of the program and exited if found, to avoid multiple instances running simultaneously.
- Fixed Time Zone Conversion and Restart Logic. Simplified and corrected the logic to restart the program at the specified time.
141 Downloads
- Added the ability to change the time zone
- Set the script to run in High Priority (was set to Realtime)
- Changed the text to display "High Priority" instead of "Realtime"
Not quite yet...