Skip to content

Running Trunk Recorder

tadscottsmith edited this page Aug 12, 2022 · 8 revisions

Running trunk recorder.

If all goes well you should now have the executable named trunk-recorder, and created the config.json configuration file as described in the Wiki and README.

From your build directory (e.g. trunk-build) you can now run ./trunk-recorder

Runtime options

Trunk Recorder will look for a config.json file in the same directory as it is being run in. You can point it to a different config file by using the --config argument on the command line, for example: ./trunk-recorder --config=examples/config-wmata-rtl.json.

Auto start as service

https://github.com/robotastic/trunk-recorder/blob/70698818065b24a494fc5488c82445609eab9ebc/examples/SETUP_SERVICE.md

Running as a Service on MacOS

Switch to the LaunchDaemons folder.

cd /Library/LaunchDaemons

Create a new plist file to define the service.

sudo vi trunk-recorder.plist

Modify the sample plist file below to meet your environment. You'll need to modify the Program, WorkingDirectory, EnvironmentVariables, UserName, and GroupName at a minimum. Make sure that your PATH includes the directory(s) where sox and fdkaac are installed. You can use the command which sox fdkaac to find their locations.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>trunk-recorder</string>

    <key>Program</key>
    <string>/Users/radio/trunk-build/trunk-recorder</string>
    <key>WorkingDirectory</key>
    <string>/Users/radio/trunk-build/</string>

    <key>EnvironmentVariables</key>
    <dict>
        <key>PATH</key>
        <string>/opt/local/bin/</string>
    </dict>

    <key>UserName</key>
    <string>radio</string>
    <key>GroupName</key>
    <string>staff</string>
    <key>InitGroups</key>
    <true/>

    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <true/>
    <key>StandardErrorPath</key>
    <string>/Users/radio/trunk-build/trunk-recorder-service.log</string>
</dict>
</plist>

Load the service using the following command.

sudo launchctl load trunk-recorder.plist

Verify that the service is running using one of the following two commands.

sudo launchctl list | grep trunk-recorder
ps -ef | grep trunk-recorder

To restart, or temporary stop and start the service, use the following commands.

launchctl stop trunk-recorder.plist
launchctl start trunk-recorder.plist