Skip to content

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

sudo systemctl start trident

Stop Trident

sudo systemctl stop trident

Enable on Boot

sudo systemctl enable trident

Or start and enable in one command:

sudo systemctl enable --now trident

Check Status

sudo systemctl status trident

View Logs

journalctl -u trident -f

Filter by time:

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

Reload Configuration

Trident supports graceful configuration reload via SIGHUP:

sudo systemctl reload trident

Unit File Details

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

[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:

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:

sysrc trident_enable="YES"

Start Trident

sudo service trident start

Stop Trident

sudo service trident stop

Reload Configuration

sudo service trident reload

rc.conf Variables

Variable Default Description
trident_enable NO Enable the service
trident_config /usr/local/etc/trident/config.toml Config file path
trident_user trident Run-as user
trident_group trident Run-as group
trident_flags (empty) Additional CLI flags
trident_pidfile /var/run/trident.pid PID file path

Example customization:

sysrc trident_config="/usr/local/etc/trident/mysite.toml"
sysrc trident_flags="--log-level debug"