Skip to content

CLI コマンドリファレンス

SirrMesh は、メールサーバーの管理とメンテナンスのためのフル機能のコマンドラインツールを提供します。

基本コマンド

sirrmeshd

メインプログラムコマンド。

bash
sirrmeshd [command] [flags]

グローバルオプション

bash
--config string      設定ファイルパス(デフォルト "~/.sirrmeshd/config.toml")
--debug              デバッグモードを有効化
--help, -h           ヘルプ情報を表示
--version, -v        バージョン情報を表示

サービス管理

run

メールサーバーを起動。

bash
sirrmeshd run [flags]

オプション:

bash
--daemon             バックグラウンドで実行
--pid-file string    PID ファイルパス

例:

bash
sirrmeshd run --config /etc/sirrmeshd/config.toml

stop

実行中のサーバーを停止。

bash
sirrmeshd stop

restart

サーバーを再起動。

bash
sirrmeshd restart

status

サーバーステータスを表示。

bash
sirrmeshd status

出力:

ステータス: 実行中
PID: 12345
稼働時間: 2日 5時間 32分
接続数: 42
処理済みメッセージ: 15,234

ユーザー管理

user create

新しいユーザーを作成。

bash
sirrmeshd user create [flags]

オプション:

bash
--username string    ユーザー名(メールアドレス)
--password string    パスワード
--quota string       ストレージクォータ(例: "5GB")
--blockchain string  ブロックチェーンウォレットアドレス

例:

bash
sirrmeshd user create \
  --username [email protected] \
  --password secretpass \
  --quota 5GB

user delete

ユーザーを削除。

bash
sirrmeshd user delete --username [email protected]

user list

すべてのユーザーをリスト。

bash
sirrmeshd user list [flags]

オプション:

bash
--domain string      ドメインでフィルター
--format string      出力フォーマット (table|json|csv)

user modify

ユーザー情報を変更。

bash
sirrmeshd user modify \
  --username [email protected] \
  --quota 10GB

user password

ユーザーパスワードを変更。

bash
sirrmeshd user password \
  --username [email protected] \
  --new-password newpass

ドメイン管理

domain add

新しいドメインを追加。

bash
sirrmeshd domain add --name example.com

domain delete

ドメインを削除。

bash
sirrmeshd domain delete --name example.com

domain list

すべてのドメインをリスト。

bash
sirrmeshd domain list

設定管理

config init

デフォルト設定ファイルを生成。

bash
sirrmeshd config init > config.toml

config verify

設定ファイルを検証。

bash
sirrmeshd config verify

config get

設定項目を取得。

bash
sirrmeshd config get server.hostname

config set

設定項目を設定。

bash
sirrmeshd config set server.hostname mail.example.com

DKIM 管理

dkim generate

DKIM キーペアを生成。

bash
sirrmeshd dkim generate \
  --domain example.com \
  --selector default \
  --bits 2048

dkim show

DKIM 公開鍵レコードを表示。

bash
sirrmeshd dkim show --domain example.com

出力:

この TXT レコードを DNS に追加:

default._domainkey.example.com. IN TXT "v=DKIM1; k=rsa; p=MIIBIjANBg..."

クォータ管理

quota get

ユーザークォータを表示。

bash
sirrmeshd quota get --user [email protected]

出力:

ユーザー: [email protected]
クォータ: 5 GB
使用量: 1.23 GB (24.6%)
利用可能: 3.77 GB

quota set

ユーザークォータを設定。

bash
sirrmeshd quota set \
  --user [email protected] \
  --quota 10GB

quota list

すべてのユーザーのクォータ使用量をリスト。

bash
sirrmeshd quota list --sort-by used

バックアップとリカバリー

backup create

バックアップを作成。

bash
sirrmeshd backup create \
  --output /backups/sirrchat-$(date +%Y%m%d).tar.gz \
  --compress

オプション:

bash
--user string        特定のユーザーのみバックアップ
--domain string      特定のドメインのみバックアップ
--exclude-attachments  添付ファイルを除外

backup restore

バックアップを復元。

bash
sirrmeshd backup restore \
  --input /backups/sirrchat-20250115.tar.gz

backup list

利用可能なバックアップをリスト。

bash
sirrmeshd backup list --path /backups

データベース管理

db migrate

データベースマイグレーションを実行。

bash
sirrmeshd db migrate

db ping

データベース接続をテスト。

bash
sirrmeshd db ping

db vacuum

データベースを最適化。

bash
sirrmeshd db vacuum

ストレージ管理

storage stats

ストレージ統計を表示。

bash
sirrmeshd storage stats

storage test

ストレージ接続をテスト。

bash
sirrmeshd storage test --type s3

storage migrate

ストレージバックエンドを移行。

bash
sirrmeshd storage migrate \
  --from local \
  --to s3

storage cleanup

期限切れデータをクリーンアップ。

bash
sirrmeshd storage cleanup \
  --older-than 2y \
  --dry-run

モジュール管理

module list

すべてのモジュールをリスト。

bash
sirrmeshd module list

module enable

モジュールを有効化。

bash
sirrmeshd module enable spam-filter

module disable

モジュールを無効化。

bash
sirrmeshd module disable spam-filter

module reload

モジュールをリロード。

bash
sirrmeshd module reload --name spam-filter

ログ管理

logs view

ログを表示。

bash
sirrmeshd logs view [flags]

オプション:

bash
--lines int          行数(デフォルト 100)
--follow, -f         リアルタイムでフォロー
--level string       ログレベルでフィルター
--grep string        キーワードでフィルター

例:

bash
sirrmeshd logs view --lines 50 --level error
sirrmeshd logs view --follow --grep "[email protected]"

モニタリングコマンド

stats

サーバー統計を表示。

bash
sirrmeshd stats

出力:

サーバー統計
-----------------
稼働時間: 2日 5時間 32分
総ユーザー数: 1,234
アクティブセッション: 42
今日のメッセージ: 5,678
ストレージ使用量: 125.5 GB

SMTP 統計
---------------
送信: 2,345
受信: 3,333
拒否: 12

IMAP 統計
---------------
アクティブ接続: 42
コマンド: 12,345

health

ヘルスチェック。

bash
sirrmeshd health

出力:

✓ データベース: OK
✓ SMTP: OK
✓ IMAP: OK
✓ ストレージ: OK
✓ メモリ: OK (45% 使用)
✓ ディスク: OK (32% 使用)

診断ツール

diagnose

診断チェックを実行。

bash
sirrmeshd diagnose

test-smtp

SMTP 機能をテスト。

bash
sirrmeshd test-smtp \
  --from [email protected] \
  --to [email protected] \
  --subject "Test Email"

test-imap

IMAP 機能をテスト。

bash
sirrmeshd test-imap \
  --user [email protected] \
  --password pass

シェル補完

シェル補完スクリプトを生成。

Bash

bash
sirrmeshd completion bash > /etc/bash_completion.d/sirrmeshd

Zsh

bash
sirrmeshd completion zsh > "${fpath[1]}/_sirrmeshd"

Fish

bash
sirrmeshd completion fish > ~/.config/fish/completions/sirrmeshd.fish

環境変数

bash
SIRRCHAT_CONFIG      設定ファイルパス
SIRRCHAT_DEBUG       デバッグモードを有効化
SIRRCHAT_LOG_LEVEL   ログレベル
SIRRCHAT_DATA_DIR    データディレクトリ

詳細情報:

Released under the GPL 3.0 License.