Mac OS X Dedicated Server

From Armagetron
Revision as of 17:18, 23 August 2021 by Cadillac (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This document describes ways in which one can run the Mac OS X dedicated server.

launchd

Launchd was first introduced in Mac OS X 10.4. It simplifies running the armagetronad-dedicated prograpm as a daemon.

The .plist file

This file should be saved to ~/LaunchAgents/net.armagetronad.armagetronad-dedicated.plist. You can create the ~/LaunchAgents directory if it doesn't yet exist.

You must edit this template. You need to insert the real path to the Armagetron Advanced Dedicated directory, and you also must insert the path to where your log-files will be saved.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
                       "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist>
    <dict>
        <key>Label</key>
        <string>net.armagetronad.armagetronad-dedicated</string>
                
        <key>ProgramArguments</key>
        <array> 
            <string>/path/to/Armagetron Advanced Dedicated/armagetronad-dedicated</string>
            <string>--datadir</string>
            <string>/path/to/Armagetron Advanced Dedicated</string>
            <string>--daemon</string>
        </array>
        
        <!-- Restart when server shuts down due to DEDICATED_IDLE -->
        <key>KeepAlive</key>
        <true/>
        
        <key>StandardOutPath</key>
        <string>/path/to/armagetronad-dedicated.log</string>
        
        <key>StandardErrorPath</key>
        <string>/path/to/armagetronad-dedicated.log</string>
    </dict>
</plist>

Loading the plist

First you must load the plist file. This is only required once.

launchctl load ~/LaunchAgents/net.armagetronad.armagetronad-dedicated.plist

If you edit the plist file later you must reload the file for changes to take effect.

launchctl unload ~/LaunchAgents/net.armagetronad.armagetronad-dedicated.plist
launchctl load ~/LaunchAgents/net.armagetronad.armagetronad-dedicated.plist

Starting/Stopping

To start the server:

launchctl start net.armagetronad.armagetronad-dedicated

To stop the server:

launchctl stop net.armagetronad.armagetronad-dedicated


Running manually

To run the server from the command-line, your current working directory must be the Armagetron Advanced Dedicated directory, else you must use the --datadir option.

Option 1:

cd "/path/to/Armagetron Advanced Dedicated"
./armagetronad-dedicated

Option 2:

"/path/to/Armagetron Advanced Dedicated/armagetronad-dedicated" --datadir "/path/to/Armagetron Advanced Dedicated"