Skip to content
Sections

Background services (Linux & macOS)

Keep your tunnels and port forwards running automatically across reboots using systemd on Linux or launchd on macOS.

On this page14

prontaro service wraps http, tcp, forward, or run commands into a managed user or system service with automatic restarts and log rotation.

Install a service

Sign in first (prontaro login). prontaro service install never writes your CLI token into the service file—the service reads your state directory. Pass the tunnel or forward command after --:

bash
# Single HTTPS tunnel (user service, no sudo)
prontaro service install -- http 3000 --name api

# Multiple saved tunnels in one service
prontaro service install -- run api pg

# Outbound port forward
prontaro service install -- forward 15432 db.example.com:5432 --ip 203.0.113.10

Expected output on Linux:

text
✓ Service prontaro-api installed; its process runs. Whether the tunnel is up: prontaro ls · its log: journalctl --user -u prontaro-api
  Next: prontaro service status -- http 3000 --name api
  Next: journalctl --user -u prontaro-api -f — log

install waits 2 seconds and checks that the process stayed up. If it exited immediately (for example, revoked token or invalid tunnel command), install exits 1 and prints the log command.

To check whether the tunnel itself is connected and accepting traffic, run prontaro ls or open Dashboard → Tunnels.

Preview before installing (--dry-run)

--dry-run prints the exact systemd unit or launchd plist to stdout without writing files or starting anything:

bash
prontaro service install --dry-run -- http 3000 --name api
ini
# /home/alice/.config/systemd/user/prontaro-api.service
# prontaro command: http 3000 --name api --state-dir /home/alice/.config/prontaro
[Unit]
Description=prontaro tunnel api

[Service]
ExecStart=/usr/local/bin/prontaro http 3000 --name api --state-dir /home/alice/.config/prontaro --no-input
ExecReload=/bin/kill -USR2 $MAINPID
Environment=PRONTARO_SERVICE=prontaro-api
Restart=on-failure
RestartSec=5
# 5 — CLI token not accepted, 6 — tunnel stopped on purpose, 7 — the command is wrong: a restart won't help
RestartPreventExitStatus=5 6 7

[Install]
WantedBy=default.target

What prontaro adds automatically:

  • Absolute --state-dir <path> so the service uses your saved token and avoids starting a duplicate of a tunnel already open in a terminal.
  • --no-input so the service never blocks waiting for interactive input.
  • Restart protection: on network drops or crashes, the service restarts after 5 seconds; on exit codes 5 (rejected token), 6 (tunnel stopped, replaced, or removed), and 7 (invalid command), it stops cleanly without looping.

Re-running install and updating tunnel lists

  • For run services (prontaro--run): running prontaro service install -- run api pg redis updates the tunnel list and restarts the unit in place—no need to uninstall first.
  • For http, tcp, and forward: if a service with that name already runs a different command, install refuses to overwrite it. Remove the old service with prontaro service uninstall first, then reinstall.

User services and --system services

Mode Runs as Linux (systemd)
Default (user) Current user ~/.config/systemd/user/prontaro-<name>.service
--system (sudo) SUDO_USER (or root if run without sudo) /etc/systemd/system/prontaro-<name>.service

On macOS (launchd), user LaunchAgents live in ~/Library/LaunchAgents/io.prontaro.<name>.plist, and --system LaunchDaemons live in /Library/LaunchDaemons/io.prontaro.<name>.plist.

Linux linger for user services

By default, Linux stops systemd --user services as soon as you close SSH and does not start them on boot. To keep tunnels running continuously, enable linger once:

bash
sudo loginctl enable-linger "$USER"

In an interactive terminal, prontaro service install checks linger and offers to enable it (pass --yes to enable it without prompting). On Linux systems without systemd (such as containers or WSL2 without systemd=true in /etc/wsl.conf), prontaro service detects this immediately and points you to running prontaro in the foreground under a container restart policy (for example, docker run --restart unless-stopped <image> prontaro forward <port> <host:port> --no-input) or enabling systemd in WSL2.

Executable requirements for --system as root

When installing a --system service directly as root (without sudo), prontaro exits with code 7 if non-root users can overwrite the executable, preventing unprivileged modification of a root service.

Install a root-owned copy into /usr/local/bin/prontaro (curl -fsSL https://prontaro.com/install.sh | sudo sh) first.

Why --takeover is disallowed in services

Managing services

List and check status

bash
# Status of a specific service (for a run group, -- run is enough)
prontaro service status -- http 3000 --name api
prontaro service status -- run

# List all installed Prontaro services on Linux
systemctl --user list-units 'prontaro-*'

# List all installed LaunchAgents on macOS
ls ~/Library/LaunchAgents/io.prontaro.*

View logs

  • Linux (systemd): read logs from journald:
    bash
    journalctl --user -u prontaro-api -f
    # For --system services:
    sudo journalctl -u prontaro-api -f
  • macOS (launchd): the plist sets PRONTARO_LOG_FILE=~/Library/Logs/prontaro/prontaro-api.log; prontaro rotates logs at 10 MiB, keeping up to 3 files (.log, .log.1, .log.2):
    bash
    tail -f ~/Library/Logs/prontaro/prontaro-api.log

Restart after updating prontaro

After updating prontaro (prontaro update or brew upgrade prontaro/tap/prontaro on macOS), reload or restart the service so it starts running the new version.

On Linux, every installed systemd unit includes ExecReload=/bin/kill -USR2 $MAINPID, so you can switch http, tcp, run, and forward services to the new binary without dropping active connections using systemctl reload (systemctl --user reload prontaro-api or sudo systemctl reload prontaro-api) — see Zero-downtime prontaro CLI updates.

For a full restart (or on macOS launchd):

bash
# Linux (zero-downtime reload for user and --system services)
systemctl --user reload prontaro-api
sudo systemctl reload prontaro-api

# Linux (full restart)
systemctl --user restart prontaro-api
sudo systemctl restart prontaro-api

# macOS (user LaunchAgent / --system LaunchDaemon)
launchctl kickstart -k "gui/$(id -u)/io.prontaro.api"
sudo launchctl kickstart -k "system/io.prontaro.api"

On macOS, prontaro service uses modern launchctl subcommands (bootstrap, bootout, kickstart, and print). You can inspect a LaunchAgent directly with launchctl print "gui/$(id -u)/io.prontaro.api".

Outbound proxy settings in services

Service managers do not inherit HTTPS_PROXY, HTTP_PROXY, or NO_PROXY from your shell, and prontaro does not copy them automatically because proxy URLs may contain passwords.

If a proxy variable is set during install, prontaro prints the exact systemd drop-in (proxy.conf, mode 0600) or launchctl setenv command.

Uninstall

bash
prontaro service uninstall -- http 3000 --name api
# For a run group:
prontaro service uninstall -- run
text
✓ Service prontaro-api removed.

Add sudo and --system when removing a system service.

Next steps

Something wrong on this page? Contact us

Contact us

Enter your email so we can reply.Enter a valid email, e.g. name@company.example.
Tell us what you need or what went wrong.up to 2,000 characters

Sent! We’ll reply to .

Or email us at support@prontaro.com