CLI Command Reference
SirrChat provides a feature-complete command-line tool for managing and maintaining the mail server.
Basic Commands
sirrchatd
Main program command.
sirrchatd [command] [flags]Global Options
--config string Configuration file path (default "~/.sirrchatd/config.toml")
--debug Enable debug mode
--help, -h Show help information
--version, -v Show version informationService Management
run
Start the mail server.
sirrchatd run [flags]Options:
--daemon Run in background
--pid-file string PID file pathExample:
sirrchatd run --config /etc/sirrchatd/config.tomlstop
Stop the running server.
sirrchatd stoprestart
Restart the server.
sirrchatd restartstatus
View server status.
sirrchatd statusOutput:
Status: Running
PID: 12345
Uptime: 2d 5h 32m
Connections: 42
Messages Processed: 15,234User Management
user create
Create new user.
sirrchatd user create [flags]Options:
--username string Username (email address)
--password string Password
--quota string Storage quota (e.g., "5GB")
--blockchain string Blockchain wallet addressExample:
sirrchatd user create \
--username user@example.com \
--password secretpass \
--quota 5GBuser delete
Delete user.
sirrchatd user delete --username user@example.comuser list
List all users.
sirrchatd user list [flags]Options:
--domain string Filter by domain
--format string Output format (table|json|csv)user modify
Modify user information.
sirrchatd user modify \
--username user@example.com \
--quota 10GBuser password
Change user password.
sirrchatd user password \
--username user@example.com \
--new-password newpassDomain Management
domain add
Add new domain.
sirrchatd domain add --name example.comdomain delete
Delete domain.
sirrchatd domain delete --name example.comdomain list
List all domains.
sirrchatd domain listConfiguration Management
config init
Generate default configuration file.
sirrchatd config init > config.tomlconfig verify
Verify configuration file.
sirrchatd config verifyconfig get
Get configuration item.
sirrchatd config get server.hostnameconfig set
Set configuration item.
sirrchatd config set server.hostname mail.example.comDKIM Management
dkim generate
Generate DKIM key pair.
sirrchatd dkim generate \
--domain example.com \
--selector default \
--bits 2048dkim show
Display DKIM public key record.
sirrchatd dkim show --domain example.comOutput:
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.
sirrchatd quota get --user user@example.comOutput:
User: user@example.com
Quota: 5 GB
Used: 1.23 GB (24.6%)
Available: 3.77 GBquota set
Set user quota.
sirrchatd quota set \
--user user@example.com \
--quota 10GBquota list
List all user quota usage.
sirrchatd quota list --sort-by usedBackup and Recovery
backup create
Create backup.
sirrchatd backup create \
--output /backups/sirrchat-$(date +%Y%m%d).tar.gz \
--compressOptions:
--user string Backup specific user only
--domain string Backup specific domain only
--exclude-attachments Exclude attachmentsbackup restore
Restore backup.
sirrchatd backup restore \
--input /backups/sirrchat-20250115.tar.gzbackup list
List available backups.
sirrchatd backup list --path /backupsDatabase Management
db migrate
Run database migrations.
sirrchatd db migratedb ping
Test database connection.
sirrchatd db pingdb vacuum
Optimize database.
sirrchatd db vacuumStorage Management
storage stats
View storage statistics.
sirrchatd storage statsstorage test
Test storage connection.
sirrchatd storage test --type s3storage migrate
Migrate storage backend.
sirrchatd storage migrate \
--from local \
--to s3storage cleanup
Clean expired data.
sirrchatd storage cleanup \
--older-than 2y \
--dry-runModule Management
module list
List all modules.
sirrchatd module listmodule enable
Enable module.
sirrchatd module enable spam-filtermodule disable
Disable module.
sirrchatd module disable spam-filtermodule reload
Reload module.
sirrchatd module reload --name spam-filterLog Management
logs view
View logs.
sirrchatd logs view [flags]Options:
--lines int Number of lines (default 100)
--follow, -f Follow logs in real-time
--level string Filter by log level
--grep string Filter by keywordExamples:
sirrchatd logs view --lines 50 --level error
sirrchatd logs view --follow --grep "user@example.com"Monitoring Commands
stats
Display server statistics.
sirrchatd statsOutput:
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,345health
Health check.
sirrchatd healthOutput:
✓ Database: OK
✓ SMTP: OK
✓ IMAP: OK
✓ Storage: OK
✓ Memory: OK (45% used)
✓ Disk: OK (32% used)Diagnostic Tools
diagnose
Run diagnostic checks.
sirrchatd diagnosetest-smtp
Test SMTP functionality.
sirrchatd test-smtp \
--from sender@example.com \
--to recipient@example.com \
--subject "Test Email"test-imap
Test IMAP functionality.
sirrchatd test-imap \
--user user@example.com \
--password passShell Completion
Generate shell completion scripts.
Bash
sirrchatd completion bash > /etc/bash_completion.d/sirrchatdZsh
sirrchatd completion zsh > "${fpath[1]}/_sirrchatd"Fish
sirrchatd completion fish > ~/.config/fish/completions/sirrchatd.fishEnvironment Variables
SIRRCHAT_CONFIG Configuration file path
SIRRCHAT_DEBUG Enable debug mode
SIRRCHAT_LOG_LEVEL Log level
SIRRCHAT_DATA_DIR Data directoryMore information: