HeartbeatSaver

From fCraft Wiki
Jump to: navigation, search

HeartbeatSaver is a utility, bundled with fCraft 0.633+, that serves as a standalone heartbeat server. It runs separately from fCraft process and reads information from a file (heartbeatdata.txt). This allows your server to keep its uptime on Minecraft.net even when your fCraft server process needs to be restarted/shutdown.

When you disable fCraft's built-in heartbeat (from the Advanced tab of ConfigGUI, or by setting HeartbeatEnabled config key to "false"), fCraft will start writing heartbeatdata.txt to disk, in fCraft's working directory.

HeartbeatSaver only works as long as its external IP address is exactly same as your server's. That means it'll always work when ran from the same machine that fCraft is on, and it will usually work from another machine on the same LAN. Heartbeat saver does not depend on any other fCraft files/libraries, and does not need to be in the same directory as the rest of your fCraft installation.

fCraft's automatic updater (UpdateInstaller) does not include HeartbeatSaver. If an update to HeartbeatSaver is ever released, it will need to be installed manually.

Usage

HeartbeatSaver
Assumes that heartbeatdata.txt is in the working directory
HeartbeatSaver "Path/To/heartbeatdata.txt"
Specifies path to the text file with heartbeat data (including the filename) explicitly.

heartbeatdata.txt format

Usually you don't need to mess with heartbeatdata.txt yourself. fCraft server will generate this for you every minute or so.

Line 01: Salt
Line 02: InternalIP
Line 03: Port
Line 04: Player count
Line 05: Max players
Line 06: Server name
Line 07: IsPublic flag ("true" or "false")
Line 08: HeartbeatUrl

For example:

MuXCwxhDCNz9BIz6aBDlNYXWWhypWwvA
0.0.0.0
25565
0
20
Custom Minecraft Server (fCraft)
False
https://minecraft.net/heartbeat.jsp

HeartbeatSaver.exe exit codes

Code Meaning Notes
0 Success HeartbeatSaver never exits, so you should never normally encounter this code
1 UsageError Required command-line arguments were missing, or an error occurred while trying to parse options.
2 HeartbeatDataReadingError Could not read heartbeat data at startup. Make sure that a valid path is given, and that the file is in correct format. If reading fails at any point AFTER the initial data is loaded, an error is printed in stderr, but HeartbeatSaver keeps running and trying.
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox
Google AdSense