GBV-Gjallar icon

Gjallar

Restart warnings for dedicated servers. Write a file with a timestamp and a reason and every player gets a countdown, on screen and in chat. Server-side only; players install nothing.

By GBV
Last updated a week ago
Total downloads 64
Total rating 1 
Categories Mods Utility Deep North Update
Dependency string GBV-Gjallar-0.1.1
Dependants 0 other packages depend on this package

This mod requires the following mods to function

denikson-BepInExPack_Valheim-5.4.2350 icon
denikson-BepInExPack_Valheim

BepInEx pack for Valheim. Preconfigured with the correct entry point for mods and preferred defaults for the community.

Preferred version: 5.4.2350

README

Gjallar

Gjallar warns players before a dedicated server restarts.

Without it a restart is a silent disconnect. Nobody is told it is coming, and nobody can tell afterwards whether the server went down on purpose, crashed, or whether their own connection dropped. Gjallar counts the restart down on screen so people can get somewhere safe and log out properly.

Named for Gjallarhorn, the horn sounded in Norse myth to warn that something is coming.

Install on the server only. Players need nothing. Gjallar announces using messages the base game already knows how to show, so there is no version to keep in step and removing Gjallar can never stop anybody joining.

Gjallar Does Not Restart Your Server

It only announces the restart. Whatever takes the server down now - a systemd timer, a cron job, an update script, a hosting panel - keeps doing that.

This is deliberate. A mod that fails to load should never be able to stop a restart happening.

There are two ways to tell Gjallar a restart is coming.

Daily Restarts

If your server restarts at the same times every day, put those times in the config:

DailyRestarts = 00:00,12:00

24-hour HH:MM, separated by commas, in the server's own local time. Gjallar counts down to each one automatically.

Because Gjallar only announces these restarts, the times have to match whatever actually performs them. Gjallar prints the next scheduled restart at startup and in gjallar_status, next to the server's current clock, so you can check the two agree.

Unplanned Restarts

For a mod update or anything else you cannot predict, write a file. Gjallar checks for it every couple of seconds, announces the countdown, and deletes it.

<unix-epoch-seconds-of-the-restart>|<reason>

For example, warning for two minutes and then restarting:

echo "$(( $(date +%s) + 120 ))|Mod update" > /opt/valheim/restart.signal
sleep 120
systemctl restart valheim

The reason is optional and appears in the message. The file lives beside BepInEx in your game folder unless you set SignalFile; gjallar_status prints the exact path.

The account your server runs as needs to be able to delete this file.

A signal file always takes priority over the daily schedule.

What Players See

A message in the middle of the screen, in the same style the game uses for its own announcements, at 90, 60, 30, 10 and 5 seconds and again when time runs out:

Server restarting in 90 seconds - Mod update

Each one is also kept in the player's message log, so somebody who stepped away can still see what happened.

If the restart is announced part-way between two marks, Gjallar opens by saying how long is actually left rather than skipping to the next mark.

Settings

Setting Default What It Does
Enabled true Turn Gjallar off without uninstalling. Does not affect whether the server restarts.
SignalFile (empty) Where to look for the signal file. Empty means restart.signal beside BepInEx.
PollSeconds 2 How often to check for a signal file.
DailyRestarts (empty) Times the server restarts each day, HH:MM separated by commas, server local time.
ScheduledReason Scheduled restart The reason shown for a daily restart.
Marks 90,60,30,10,5 Seconds remaining at which to announce.
AnnounceOnPickup true Announce immediately when a restart is first known about.
AnnounceAtZero true A final message when time runs out.
Template Server restarting in {seconds} seconds - {reason} The wording. {seconds} and {reason} are filled in.
ZeroTemplate Server restarting now - {reason} The wording for the final message.
CentreScreen true The message in the middle of the screen.
ChatLine false Also announce in chat. Off by default - the game renders it as yellow capitals across the bottom left, which alongside the centre message reads as the same warning twice.
ChatName Server The name shown against the chat line.

Commands

Admin only. A dedicated server has no console to type into, so these are mainly for testing on a local host.

Command What It Does
gjallar_status The signal file path, the server clock, the next scheduled restart, and any countdown running.
gjallar_test <seconds> [reason] Announce a countdown without writing a file. Restarts nothing.
gjallar_cancel Stop the countdown that is running. Does not stop a real restart.

If Something Is Not Working

Everything below is written to the server's log, and every announcement Gjallar sends is logged.

  • Nothing is announced. Check the signal file path in gjallar_status against where your script writes.
  • The same restart is announced repeatedly. The server cannot delete the signal file. Check its ownership.
  • A daily restart is announced at the wrong time. Compare the server clock shown in gjallar_status against the times you set. Servers are often left on UTC.
  • A signal was ignored. Either it was left over from a restart that already happened, or the timestamp was more than 24 hours ahead, which usually means milliseconds were written where seconds were expected.