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 tridentStop Trident
Bash
sudo systemctl stop tridentEnable on Boot
Bash
sudo systemctl enable tridentOr start and enable in one command:
Bash
sudo systemctl enable --now tridentCheck Status
Bash
sudo systemctl status tridentView Logs
Bash
journalctl -u trident -fFilter by time:
Bash
journalctl -u trident --since "1 hour ago"Reload Configuration
Trident supports graceful configuration reload via SIGHUP:
Bash
sudo systemctl reload tridentUnit 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.targetKey properties:
- Runs as
tridentuser -- 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.tomlEdit 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 startStop Trident
Bash
sudo service trident stopReload Configuration
Bash
sudo service trident reloadrc.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:
Bash
sysrc trident_config="/usr/local/etc/trident/mysite.toml"
sysrc trident_flags="--log-level debug"Was this page helpful?