Shutdown-Script for Don't Starve Together Dedicated Server
table.getn has been deprecated for more than 2 years now.
Why iterate only until n-1?
I'd prefer using the string.format over plain concatenation. This is just a personal preference, as the strings are easier to read that way.
Although you do not need to pass true to the c_shutdown, do mention in a comment what it does. Maintaining comments is a nice way to recognise engine specific hard-bound parameters; without having to refer the docs again.
Iterate over the table using ipairs


Rewritten, the code would be:

local function sleep(seconds)
    local diff, t = 0, os.time()
    while diff &lt; seconds do
        diff = os.difftime(os.time(), t)
    end
end

local steps = {
  120, 60, 30,
  10, 5, 4, 3,
  2, 1
}
local notice = "The server shuts down in %d seconds"

for _, secs in ipairs(steps) do
  TheNet:SystemMessage(notice:format(secs))
  sleep(secs)
end
TheNet:SystemMessage("The server is shutting down now")
c_shutdown(true)  -- true parameter implies that the game will be saved