[GH-ISSUE #193] Autostart on MacOS #128

Closed
opened 2026-03-03 16:04:39 +03:00 by kerem · 1 comment
Owner

Originally created by @buzink on GitHub (Feb 1, 2020).
Original GitHub issue: https://github.com/mthenw/frontail/issues/193

Is there any way to run frontail as a service on MacOS? I installed frontail through npm (and node-js through homebrew) and made the following launchctl file:

<?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>/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>

I get the following error:

env: node: No such file or directory

The same command given directly in the shell works fine.

What am I doing wrong?

Originally created by @buzink on GitHub (Feb 1, 2020). Original GitHub issue: https://github.com/mthenw/frontail/issues/193 Is there any way to run frontail as a service on MacOS? I installed frontail through npm (and node-js through homebrew) and made the following launchctl file: ``` <?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>/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> ``` I get the following error: `env: node: No such file or directory` The same command given directly in the shell works fine. What am I doing wrong?
kerem closed this issue 2026-03-03 16:04:39 +03:00
Author
Owner

@buzink commented on GitHub (Feb 1, 2020):

Solved it. The problem was the env path to /usr/local/bin/ was missing. I don't know how to set that in the launchd-file, so I created a shell script and set it in there. The launchd-file starts the shell script.

~/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
<!-- gh-comment-id:581069679 --> @buzink commented on GitHub (Feb 1, 2020): Solved it. The problem was the env path to /usr/local/bin/ was missing. I don't know how to set that in the launchd-file, so I created a shell script and set it in there. The launchd-file starts the shell script. ~/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 ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/frontail#128
No description provided.