OSX.plist
で使用するファイルをセットアップしようとしています。launchctl
コマンドラインから ( を使用せずlaunchctl
に) 実行すると、アプリケーションは次のように実行されます。
/path/to/ourapp
... アプリケーションを終了するには、次のように入力します。
/path/to/ourapp -k
...これにより、の新しいインスタンスが、ourapp
実行中の以前のインスタンスを適切に強制終了します。
次に、次のように、 を.plist
介してアプリケーションの実行を制御するファイルを設定します。launchctl
// start.plist
<dict>
<key>Disabled</key>
<false/>
<key>Label</key>
<string>ourapp</string>
<key>ProgramArguments</key>
<array>
<string>/path/to/ourapp</string>
</array>
<key>OnDemand</key>
<false/>
<key>UserName</key>
<string>daniel347x</string>
<key>SHAuthorizationRight</key>
<string>system.preferences</string>
</dict>
...そして、次のようにコマンドラインで実行します。
launchctl load /path/to/start.plist
これは正常に機能し、アプリケーションを起動します。
残念ながら、 を作成するときはstop.plist
、次のようになります (唯一の違いは、-k
引数の追加です)。
// stop.plist
<dict>
<key>Disabled</key>
<false/>
<key>Label</key>
<string>ourapp</string>
<key>ProgramArguments</key>
<array>
<string>/path/to/ourapp</string>
<string>-k</string> // <-- only difference is adding this argument
</array>
<key>OnDemand</key>
<false/>
<key>UserName</key>
<string>daniel347x</string>
<key>SHAuthorizationRight</key>
<string>system.preferences</string>
</dict>
...そして経由で実行
launchctl unload /path/to/stop.plist
... アプリケーションは終了しません ... したがって、 を使用するlaunchctl
と、アプリケーションは同等に実行されていないようです
/path/to/ourapp -k
誰かが実際に何をしているのかを教えてもらえますか?launchctl unload
つまり、指定された引数を使用してコマンドラインからアプリケーションを呼び出してstop.plist
いるlaunchctl unload
かどうか?