Skip to content

CLI Command Reference ​

SirrMesh provides a full-featured command-line tool for managing and maintaining the mail server.

Basic Commands ​

sirrmeshd ​

Main program command.

bash
sirrmeshd [command] [flags]

Global Options ​

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

Service Management ​

run ​

Start the mail server.

bash
sirrmeshd run [flags]

Options:

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

Example:

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

stop ​

Stop the running server.

bash
sirrmeshd stop

restart ​

Restart the server.

bash
sirrmeshd restart

status ​

View server status.

bash
sirrmeshd status

Output:

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

User Management ​

user create ​

Create a new user.

bash
sirrmeshd 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
sirrmeshd user create \
  --username [email protected] \
  --password secretpass \
  --quota 5GB

user delete ​

Delete a user.

bash
sirrmeshd user delete --username [email protected]

user list ​

List all users.

bash
sirrmeshd user list [flags]

Options:

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

user modify ​

Modify user information.

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

user password ​

Change user password.

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

Domain Management ​

domain add ​

Add a new domain.

bash
sirrmeshd domain add --name example.com

domain delete ​

Delete a domain.

bash
sirrmeshd domain delete --name example.com

domain list ​

List all domains.

bash
sirrmeshd domain list

Configuration Management ​

config init ​

Generate default configuration file.

bash
sirrmeshd config init > config.toml

config verify ​

Verify configuration file.

bash
sirrmeshd config verify

config get ​

Get configuration item.

bash
sirrmeshd config get server.hostname

config set ​

Set configuration item.

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

DKIM Management ​

dkim generate ​

Generate DKIM key pair.

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

dkim show ​

Show DKIM public key record.

bash
sirrmeshd 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
sirrmeshd quota get --user [email protected]

Output:

User: [email protected]
Quota: 5 GB
Used: 1.23 GB (24.6%)
Available: 3.77 GB

quota set ​

Set user quota.

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

quota list ​

List all user quota usage.

bash
sirrmeshd quota list --sort-by used

Backup and Restore ​

backup create ​

Create a backup.

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

Options:

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

backup restore ​

Restore from backup.

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

backup list ​

List available backups.

bash
sirrmeshd backup list --path /backups

Database Management ​

db migrate ​

Run database migrations.

bash
sirrmeshd db migrate

db ping ​

Test database connection.

bash
sirrmeshd db ping

db vacuum ​

Optimize database.

bash
sirrmeshd db vacuum

Storage Management ​

storage stats ​

View storage statistics.

bash
sirrmeshd storage stats

storage test ​

Test storage connection.

bash
sirrmeshd storage test --type s3

storage migrate ​

Migrate storage backend.

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

storage cleanup ​

Clean up expired data.

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

Module Management ​

module list ​

List all modules.

bash
sirrmeshd module list

module enable ​

Enable a module.

bash
sirrmeshd module enable spam-filter

module disable ​

Disable a module.

bash
sirrmeshd module disable spam-filter

module reload ​

Reload a module.

bash
sirrmeshd module reload --name spam-filter

Log Management ​

logs view ​

View logs.

bash
sirrmeshd logs view [flags]

Options:

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

Examples:

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

Monitoring Commands ​

stats ​

Display server statistics.

bash
sirrmeshd 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
sirrmeshd 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
sirrmeshd diagnose

test-smtp ​

Test SMTP functionality.

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

test-imap ​

Test IMAP functionality.

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

Shell Completion ​

Generate shell completion scripts.

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

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.