GMOD | Timed Restart

Hey i have a quick question. I would like my server to restart every 24 hours at like 4am or something. How could i accomplish this ?

Im guessing its going to have to be a external program as lua won’t be able to do this ?

Lua is able to do this, but the timers can be affected, therefore if you’re hosting this server by yourself(hopefully linux) use cron, if its an bought server, your provider might be able to help you.

Another post by whitestar with made up unhelpful crap in it.

You cannot restart/stop/start a server using Lua (Unless you crash it). If you’re using a shared host then you can’t do anything apart from contacting them or looking around the control panel for some sort of scheduled restart application.

If you’re hosting yourself either use Windows Task Scheduler or (well done whitestar you got this right) cron if you’re on Linux.

Im in complete control of the server(VPS) and i am using Linux. Ill check out Cron.

Install crontab and use the following:

0 4 * * * YourStopStartCommandHere

It’ll run at 4am every day

Could you like, please stop being a cunt? The mods also told me telling you that, and if you dont stop, I shall contact them again. Also, Crontab is installed in most distros by default + it IS possible to restart the server with Lua, there was already a thread about it.

Are you being serious?

I have written a detailed explanation how to auto restart using screen or via start script here: http://forum.facepunch.com/showthread.php?t=1483271&p=48567247&viewfull=1#post48567247

Also as far as I know it is actually possible to restart using lua. Make a new cfg file in the cfg folder and write stop into it, then exec the file via runconsole in your lua script (however I’m not 100% sure about this one).

-nvm- they for whatever reason blocked _restart

This works: RunConsoleCommand("_restart")

_restart is in the blacklist. for whatever reason.



game.ConsoleCommand( "_restart" )


Maybe, no idea works or not, but should probably?

every Console command function looks through the blacklist ( https://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index33a2-2.html )
the list is:



"con_enable"
"sv_cheats",
"_restart",
"exec",
"condump",
"connect",
"bind",
"BindToggle",
"alias",
"ent_fire",
"ent_setname",
"sensitivity",
"name",
"r_aspect",
"quit",
"exit",
"lua_run",
"lua_run_cl",
"lua_open",
"lua_cookieclear",
"lua_showerrors_cl",
"lua_showerrors_sv",
"lua_openscript",
"lua_openscript_cl",
"lua_redownload",
"sent_reload",
"sent_reload_cl",
"swep_reload",
"swep_reload_cl",
"gamemode_reload",
"gamemode_reload_cl",
"con_logfile",
"clear",
"rcon_password",
"test_RandomChance",
"plugin_load",


It still works because I am using it.
Take your list and stick it.

then sorry, since it didnt work for me with whatever reason - you sure you didnt install a module?

No, but Robotboy did mention it was unblocked a few updates ago…

I dont really read through the update posts on facepunch & steam sometimes downloads stuff without notifying me, sorry! :c

Are you testing on a dedicated server or on the client?
It would make sense if it was blocked on the client.

Dedicated server, _restart is an server only command, everyone knows that, lol. if its clientside it would only restart the client.

It wouldn’t do anything on the client.