Closed TomLewis closed 2 years ago
You can already do this with the scripting events, in fact I use it on my servers to report crashes to a discord webhook. I can think of a few ways to do this, and adding something explicitly for this isn't really worth the development time in my opinion.
ServerStopped
event and run your script of choiceIn my code, I move reports to another folder inside the crash reports folder called reported
and also keep a list of files stored with my script that is checked to ensure reported crashes are not re-reported.
ServerStopping
event and use the event arg formatting to pass the reason to your scriptcrashed
and if it has crashed, scan crash reports folder like beforeServerOutput
event and use the event arg formatting to pass the outputted line to your scriptNot sure if this will work since server output events require a regex, but it could potentially work. Although this will slow mark2 down in all likelyhood since for every outputted line, mark2 would need to spawn a process to run your script.
I'll try and make my crash reporter script public, it's in a private gitlab ATM and I don't have admin rights to change it's visibility settings 🙁
Here you can find the code my network uses to report crashes to a discord webhook, should have all the instructions for setting it up if you want to use it and modify it for your purposes.
This is utterly amazing, what a great idea! When I get some spare time I will be looking into implementing your crash_reporter.py! So simple, such a great idea. It is weird that there is no crash event, seeing that mark knows when theres a crash, as it changes the filename for mark2 logs specifically to tell me its a crash log file.
Let us run a local script when mark2 detects a crash. Then we can tell our script to do whatever we want.
I'm thinking, send me a pushbullet Pop a message into staff Google chat Post a small message to discord staff Email me the crash log, this would also require a placeholder to easily get the crash log filename.