Welcome to The Forum

Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads

Recommended Posts

This is just something I've been working on to pass the time. I started it this afternoon, and after spending a good amount of time on it, decided to post it here.

 

What this is is a watchdog module written in c++ for garrys mod, but could in theory be written for any source engine game. I wrote this to see if it could be a solution to events where the server crashes, and never restarts. I assume the server has a batch script to restart it in the event the srcds.exe process ends, so this is to help the server out when it locks up, but doesn't completely crash.

 

It keeps a watchdog timer running on a separate thread that has to be reset by the server every tick. When this timer runs out, it does whatever you would like it to do when the server locks up. This could be restarting the server, or even the entire system if desired. Resetting the timer has no impact on server performance.

 

This project also contains a standard library I've been working on for gmod modules in c++. ATM it doesn't do much, but it's a start. I plan to add on to this as I develop.

 

Also, there are a few bugs. The most problematic one being the watchdog thread not releasing the timer values to the server thread. It should be an easy fix, but it's been a long day.

 

The whole thing is on GitHub of anyone feels interested.

https://github.com/Techmo2/GM-Watchdog

 

EDIT:

Added a link to the binary on the GitHub readme because if you're like me, you're probably too lazy to compile it. If scrolling more than a few inches isn't your thing either, i'll add a link here.

Edited by Techmo
  • Like 7
Link to comment
Share on other sites

Finally decided to take the time to add scripting. When the timer is started, it reads a path from 'watchdog.cfg' located in the 'garrysmod' folder. It then starts the file defined (usually a batch file) when a crash is detected.

The cfg file will be created when the server starts for the first time, but the path of the file to be executed needs to be placed inside. This path should be fully qualified, as it is not referenced from the directory of the cfg file itself.

 

If you aren't in the compiling mood, I have the binary here.

Edited by Techmo
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share