Skip to content

CLI Command Reference

SirrChat provides a feature-complete command-line tool for managing and maintaining the mail server.

Basic Commands

sirrchatd

Main program command.

bash
sirrchatd [command] [flags]

Global Options

bash
--config string      Configuration file path (default "~/.sirrchatd/config.toml")
--debug              Enable debug mode
--help, -h           Show help information
--version, -v        Show version information

Service Management

run

Start the mail server.

bash
sirrchatd run [flags]

Options:

bash
--daemon             Run in background
--pid-file string    PID file path

Example:

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

stop

Stop the running server.

bash
sirrchatd stop

restart

Restart the server.

bash
sirrchatd restart

status

View server status.

bash
sirrchatd status

Output:

Status: Running
PID: 12345
Uptime: 2d 5h 32m
Connections: 42
Messages Processed: 15,234

User Management

user create

Create new user.

bash
sirrchatd user create [flags]

Options:

bash
--username string    Username (email address)
--password string    Password
--quota string       Storage quota (e.g., "5GB")
--blockchain string  Blockchain wallet address

Example:

bash
sirrchatd user create \
  --username user@example.com \
  --password secretpass \
  --quota 5GB

user delete

Delete user.

bash
sirrchatd user delete --username user@example.com

user list

List all users.

bash
sirrchatd user list [flags]

Options:

bash
--domain string      Filter by domain
--format string      Output format (table|json|csv)

user modify

Modify user information.

bash
sirrchatd user modify \
  --username user@example.com \
  --quota 10GB

user password

Change user password.

bash
sirrchatd user password \
  --username user@example.com \
  --new-password newpass

Domain Management

domain add

Add new domain.

bash
sirrchatd domain add --name example.com

domain delete

Delete domain.

bash
sirrchatd domain delete --name example.com

domain list

List all domains.

bash
sirrchatd domain list

Configuration Management

config init

Generate default configuration file.

bash
sirrchatd config init > config.toml

config verify

Verify configuration file.

bash
sirrchatd config verify

config get

Get configuration item.

bash
sirrchatd config get server.hostname

config set

Set configuration item.

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

DKIM Management

dkim generate

Generate DKIM key pair.

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

dkim show

Display DKIM public key record.

bash
sirrchatd dkim show --domain example.com

Output:

Add this TXT record to your DNS:

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

Quota Management

quota get

View user quota.

bash
sirrchatd quota get --user user@example.com

Output:

User: user@example.com
Quota: 5 GB
Used: 1.23 GB (24.6%)
Available: 3.77 GB

quota set

Set user quota.

bash
sirrchatd quota set \
  --user user@example.com \
  --quota 10GB

quota list

List all user quota usage.

bash
sirrchatd quota list --sort-by used

Backup and Recovery

backup create

Create backup.

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

Options:

bash
--user string        Backup specific user only
--domain string      Backup specific domain only
--exclude-attachments  Exclude attachments

backup restore

Restore backup.

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

backup list

List available backups.

bash
sirrchatd backup list --path /backups

Database Management

db migrate

Run database migrations.

bash
sirrchatd db migrate

db ping

Test database connection.

bash
sirrchatd db ping

db vacuum

Optimize database.

bash
sirrchatd db vacuum

Storage Management

storage stats

View storage statistics.

bash
sirrchatd storage stats

storage test

Test storage connection.

bash
sirrchatd storage test --type s3

storage migrate

Migrate storage backend.

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

storage cleanup

Clean expired data.

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

Module Management

module list

List all modules.

bash
sirrchatd module list

module enable

Enable module.

bash
sirrchatd module enable spam-filter

module disable

Disable module.

bash
sirrchatd module disable spam-filter

module reload

Reload module.

bash
sirrchatd module reload --name spam-filter

Log Management

logs view

View logs.

bash
sirrchatd logs view [flags]

Options:

bash
--lines int          Number of lines (default 100)
--follow, -f         Follow logs in real-time
--level string       Filter by log level
--grep string        Filter by keyword

Examples:

bash
sirrchatd logs view --lines 50 --level error
sirrchatd logs view --follow --grep "user@example.com"

Monitoring Commands

stats

Display server statistics.

bash
sirrchatd stats

Output:

Server Statistics
-----------------
Uptime: 2d 5h 32m
Total Users: 1,234
Active Sessions: 42
Messages Today: 5,678
Storage Used: 125.5 GB

SMTP Statistics
---------------
Sent: 2,345
Received: 3,333
Rejected: 12

IMAP Statistics
---------------
Active Connections: 42
Commands: 12,345

health

Health check.

bash
sirrchatd health

Output:

✓ Database: OK
✓ SMTP: OK
✓ IMAP: OK
✓ Storage: OK
✓ Memory: OK (45% used)
✓ Disk: OK (32% used)

Diagnostic Tools

diagnose

Run diagnostic checks.

bash
sirrchatd diagnose

test-smtp

Test SMTP functionality.

bash
sirrchatd test-smtp \
  --from sender@example.com \
  --to recipient@example.com \
  --subject "Test Email"

test-imap

Test IMAP functionality.

bash
sirrchatd test-imap \
  --user user@example.com \
  --password pass

Shell Completion

Generate shell completion scripts.

Bash

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

Zsh

bash
sirrchatd completion zsh > "${fpath[1]}/_sirrchatd"

Fish

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

Environment Variables

bash
SIRRCHAT_CONFIG      Configuration file path
SIRRCHAT_DEBUG       Enable debug mode
SIRRCHAT_LOG_LEVEL   Log level
SIRRCHAT_DATA_DIR    Data directory

More information:

Released under the GPL 3.0 License.