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

Thank you for creating these instructions. I am trying to follow along and have got to step 5 but then I hit a problem. I am a bit clueless about all this stuff so any help as to what to do next would be very gratefully received. When I run the command in step 5 I get the following error message:

/Users/Server/Library/LaunchAgents/frontail.openhab.logs.plist: Path had bad ownership/permissions

OK never mind, managed to fix that with:

sudo chown root:wheel ~/Library/LaunchAgents/frontail.openhab.logs.plist

Now I managed to do steps 5 and 6 and they seemed to work (no output). Then when I visit my.ip:9001 there’s nothing doing. I’ve run out of ideas this time. Once again, any help gratefully received.