0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

launchctlコマンド操作マニュアル(Macサービス管理)

Posted at

サービス管理コマンド 「launchctl」

Mac環境でサービス管理を行うlaunchctlコマンドの使い方をまとめています。plistファイル設定方法もあわせて解説。

コマンド

launchctl

オプション

オプション 説明
start サービス開始
stop サービス停止
list サービス有効なものを確認
load サービス有効
unload サービス無効

⚠️ エラーが起きた時などplist変更加えた後はunloadしてloadする

ファイルを置き場

~/Library/LaunchAgents/

plist

  • dictionayのkey-valueで構成

  • Label: plist このファイル名

  • ProgramArguments: [スクリプトフルパス]

  • StartCalendarInterval: {Hour: 時間} {Minute: 分}

  • StandardOutPath: /tmp/<ファイル名>.log # ログ

  • StandardErrorPath: /tmp/<ファイル名>.error # エラーログ

  • RunAtLoad: true

サンプル

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.<ユーザー名(識別できればなんでも良い)>.<ファイル名(識別できればなんでも良い)></string>

    <key>ProgramArguments</key>
    <array>
        <string><スクリプトパス></string>
    </array>

    <key>StartCalendarInterval</key>
    <dict>
        <key>Hour</key>
        <integer><実行時間(時間)></integer>
        <key>Minute</key>
        <integer><実行時間(分)></integer>
    </dict>

    <key>StandardOutPath</key>
    <string>/tmp/<ファイル名>.log</string>

    <key>StandardErrorPath</key>
    <string>/tmp/<ファイル名>.error</string>

    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>

1891年 ヴィクトリア朝のシャーロックホームズの世界に3名の生成AIが突如現れる。
現代社会の不可思議なビジネス課題をこの3名の生成AIが謎に迫る。

ビジネスコンテンツ × ミステリー × 生成AIの世界観をお楽しみください。

ROI探偵事務所の事件で使用した知識をこちらに掲載しています

0
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?