Set up Frontail as a service on MacOS

To install and autostart Frontail on MacOS, do the following

  1. Install homebrew
  2. Install node.js
  3. Install frontail
  4. Create these two files:

~/Library/LaunchAgents/frontail.openhab.logs.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs>
<plist version="1.0">
<dict>
  <key>Label</key>
  <string>frontail.openhab.logs</string>
  <key>ProgramArguments</key>
  <array>
    <string>/Users/buzink/frontail.sh</string>
    <!-- <string>/usr/local/bin/frontail</string>
    <string>/usr/local/lib/node_modules/frontail/bin/frontail</string>>
    <string>-d</string>
    <string>--pid-path /tmp/frontail.pid</string>
    <string>/Users/buzink/openhab/userdata/logs/*.log</string>-->
  </array>
  <key>RunAtLoad</key>
  <true/>
  <key>KeepAlive</key>
  <false/>
  <key>StandardErrorPath</key>
  <string>/tmp/frontail.openhab.logs.err</string>
  <key>StandardOutPath</key>
  <string>/tmp/frontail.openhab.logs.out</string>
  <key>WorkingDirectory</key>
  <string>/usr/local/lib/node_modules/frontail/</string>
</dict>
</plist>

~/frontail.sh:

#!/bin/bash
export PATH="$PATH:"/usr/local/bin/
/usr/local/bin/frontail -d --pid-path /tmp/frontail.pid /Users/buzink/openhab/userdata/logs/*.log
  1. Load the plist file:

launchctl load ~/Library/LaunchAgents/frontail.openhab.logs.plist

  1. Start the service:

launchctl start frontail.openhab.logs