私の質問は、リブート後にlaunchd startをroot権限で自動的に使用してMacOSXデーモンプロセスを作成する方法です。Mac OSX launchctlを起動時にプロセスとして起動する
私は、ウェブサイトへのアクセスをブロックする社内向けのアプリケーションを作成しています。これはPythonで書かれ、/ ect/hostsファイルを変更して、リストされたURLを無効または有効にします。主なアプリケーションはdjangoにあり、rootアクセス権限が必要なため、/ etc/hostsファイルの実際の修正を行うpython twistedデーモンを作成しました。
私は1つの小さな問題で動作するplistファイルを作成しました。再起動後、デーモンプロセスはroot特権ではなく通常のログオン特権を持ちます。
回避策は、通常の権限でプロセスを停止し、sudoでプロセスを起動することです。あなたが間違ったディレクトリにこれを入れている
launchctl unload /Library/LaunchAgents/com.balanceinfosystems.socialshields.twisted.plist
sudo launchctl load /Library/LaunchAgents/com.balanceinfosystems.socialshields.twisted.plist
plistファイル
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd >
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.balanceinfosystems.socialshields.twisted</string>
<key>Program</key>
<string>/source/social_shields/social_shields_twisted.py</string>
<key>KeepAlive</key>
<true/>
</dict>
</plist>
ありがとうございます。乾杯キース。 –