5
1

More than 5 years have passed since last update.

Mac OS X で各種アプリのデーモン化

Last updated at Posted at 2018-04-17

インスタレーションなどやるときに、Mac OS X でファイルオープンが必要な各種アプリをデーモン化する方法のメモです。

launchd とか、 supervisord とか、いろんなやり方があるぽいのですが、今回は、以下をつかいました

  • mongroup
  • automator
  • スタートアップ項目

まず mongroup を install して。

npm install -g mongroup

特定ディレクトリ移動して、 mongroup.conf をつくって、以下のような設定をする。

on-error = ./bin/on-error.sh
on-restart = ./bin/on-restart.sh

attempts = 3
logs = ./logs
pids = ./tmp/pids

# ファイルオープンが必要なアプリの場合(maxmspなど。)
app1 = open -W (特定のファイルへのパス)

# コマンドで実行できるアプリの場合
app2 = cd (ディレクトリへのパス) && ./(実行したいバイナリファイル)

※ ファイルオープンが必要なアプリの場合、mongroup stopでキレイに終了してもらないので、改善の余地がありまくり。

automator で以下のような shell script を実行する。

export PATH=$PATH:/usr/local/bin
cd (mongroup.conf があるディレクトリへのパス) 
mongroup start 

で、automator のファイルを system 環境設定のスタートアップ項目へ。

5
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
1