Any trick to restart (linux) server if stucks at 100% cpu usage?

Hi guys

today I saw something weird. I have a garrys mod linux debian server. Everything works good but today when I opened my hlsw I saw my build server had a timeout. So of course I was looking for it and I saw with the “top” command my build server was at 100 % CPU usage.

the latest console messages were just few chat messages and something like three times "SetLocalOrigin… x,y,z gmod_hands) where x y z were real very different coordinates.
So I need to close the server with ctrl + c and restart

So what could it cause it then? Were they maybe out of the map and spawned gmod hands?
Do you have any idea how to detect something like that to restart server with scripts like?

You have no LUA errors at all right?

You should find the reason for the 100% CPU usage instead of trying to restart it.

first thing do have access to the whole machine ? if yes then maybe an other process is taking all cpu resources. I mean you probably do since you ran “top”…

so check other process maybe one in the background is taking a lot of resources.

if not then maybe you should investigate your lua errors

Hello, sorry for late response. I have currently no internet. I am online with my mobile phone internet lol.

I didn’t see any lua error

And yes I have full access to the root dedicated server. No other processes are not taking “all” resources because I run two server and the other one has no problems. Its just TTT server.

Its just sometimes build server if there are many props and physics spams or sometimes it getting laggy or high cpu usage (which I can understand) but very rare my top first post problem.

In this few weeks for example the server had no problem.

I would suggest restricting building using prop limits rather than forcibly shutting down the server.
Kicking players off because they’re building too much is counter intuitive and will detract from your playerbase.