&tag(launchctl);
*目次 [#ab14354f]
#contents
*参考情報 [#eb6f3869]
-[[LaunchDaemons (launchctl, launchd.plist) の使い方 - maruko2 Note.:http://www.maruko2.com/mw/LaunchDaemons_(launchctl,_launchd.plist)_%E3%81%AE%E4%BD%BF%E3%81%84%E6%96%B9]]
-[[Mac の launchctl ってなんだ? - IT戦記:http://d.hatena.ne.jp/amachang/20080108/1199778615]]
-[[launchd.plist(5) Mac OS X Manual Page:http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man5/launchd.plist.5.html#//apple_ref/doc/man/5/launchd.plist]]
-[[Mac OSにおける、initや/etc/rcやcronの代わりであるlaunchdの使い方 - kanonjiの日記:http://d.hatena.ne.jp/kanonji/20100621/1277075926]]

*使用方法 [#n195e0c9]

**自動起動する [#g69dc7e4]
 $sudo launchctrl load -w xxx.plist

※Mountain Lion組み込みのApacheは先にとめておくこと。
**自動起動を停止する [#s0920baa]
 $sudo launchctl unload -w xxx.plist
**一覧表示する [#g3860766]
root権限で動作するものは一般ユーザーでは表示されないので注意。
 $ sudo launchctrl list

***出力の意味 [#y2948c2e]
-[[macosx - What do the numbers in launchctl list's status column mean? - Server Fault:http://serverfault.com/questions/311160/what-do-the-numbers-in-launchctl-lists-status-column-mean]]によると、Status=last exit code。
#pre{{
$ launchctl list
PID	Status	Label
2004	-	0x7fcd0ac358b0.anonymous.launchctl
1913	-	0x7fcd0ac355b0.anonymous.Google Chrome H
764	-	0x7fcd0ac352b0.anonymous.Google Chrome H
754	-	0x7fcd0ac36050.anonymous.Google Chrome H
}}

*設定ファイルの場所による権限の違い [#s12a9951]
-[[osx - How do I run a launchd command as root - Super User:http://superuser.com/questions/36087/how-do-i-run-a-launchd-command-as-root]]
-以下の場所にplistファイルを設定することができる。
#pre{{
~/Library/LaunchAgents
/Library/LaunchAgents
/Library/LaunchDaemons
/System/Library/LaunchAgents
/System/Library/LaunchDaemons
}}
-以下の場所にplistファイルを設定することができる(man launchdで確認可能)。
,~/Library/LaunchAgents,Per-user agents provided by the user.
,/Library/LaunchAgents,Per-user agents provided by the administrator.
,/Library/LaunchDaemons,System-wide daemons provided by the administrator.
,/System/Library/LaunchAgents,Per-user agents provided by Mac OS X.
,/System/Library/LaunchDaemons,System-wide daemons provided by Mac OS X.
-LaunchDaemonsに置くもはroot権限で起動されログインせずとも起動される。
-LaunchAgentsに置くのはユーザー権限で起動されログイン時に起動される。


トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS