2 min readMar 29, 2026by jakub

Service Management

Trident ships with service integration for both systemd (Linux) and rc.d (FreeBSD).

systemd (Linux)

The systemd unit file is installed automatically by the package or by using --with-service with the install script.

Start Trident

Bash
sudo systemctl start trident

Stop Trident

Bash
sudo systemctl stop trident

Enable on Boot

Bash
sudo systemctl enable trident

Or start and enable in one command:

Bash
sudo systemctl enable --now trident

Check Status

Bash
sudo systemctl status trident

View Logs

Bash
journalctl -u trident -f

Filter by time:

Bash
journalctl -u trident --since "1 hour ago"

Reload Configuration

Trident supports graceful configuration reload via SIGHUP:

Bash
sudo systemctl reload trident

Unit File Details

The default unit file (/lib/systemd/system/trident.service):

INI
[Unit]
Description=Trident HTTP Cache Proxy
Documentation=https://github.com/qoliber/trident
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
User=trident
Group=trident
EnvironmentFile=-/etc/default/trident
ExecStart=/usr/bin/trident --config ${TRIDENT_CONFIG}
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
RestartSec=5s

# Security hardening
AmbientCapabilities=CAP_NET_BIND_SERVICE
NoNewPrivileges=true
ProtectSystem=strict
ProtectHome=true
ReadWritePaths=/var/lib/trident /var/log/trident
PrivateTmp=true
PrivateDevices=true
ProtectKernelTunables=true
ProtectKernelModules=true
ProtectControlGroups=true

# Resource limits
LimitNOFILE=65535
LimitNPROC=4096

[Install]
WantedBy=multi-user.target

Key properties:

  • Runs as trident user -- never as root
  • CAP_NET_BIND_SERVICE -- allows binding to ports below 1024
  • Security hardening -- filesystem, kernel, and device protections enabled
  • Auto-restart -- restarts on failure after 5 seconds
  • 65535 file descriptors -- sufficient for high-concurrency workloads

Environment File

The config path is set via /etc/default/trident:

Bash
TRIDENT_CONFIG=/etc/trident/config.toml

Edit this file to change the configuration file path or add environment variables.


rc.d (FreeBSD)

Enable Trident

Add to /etc/rc.conf:

Bash
sysrc trident_enable="YES"

Start Trident

Bash
sudo service trident start

Stop Trident

Bash
sudo service trident stop

Reload Configuration

Bash
sudo service trident reload

rc.conf Variables

VariableDefaultDescription
trident_enableNOEnable the service
trident_config/usr/local/etc/trident/config.tomlConfig file path
trident_usertridentRun-as user
trident_grouptridentRun-as group
trident_flags(empty)Additional CLI flags
trident_pidfile/var/run/trident.pidPID file path

Example customization:

Bash
sysrc trident_config="/usr/local/etc/trident/mysite.toml"
sysrc trident_flags="--log-level debug"
Was this page helpful?
Service Management — Trident HTTP Cache Proxy | qoliber Docs