#!/bin/sh
export GOTRACEBACK=crash

# Raise the open-file cap: the agent may hold many concurrent network
# sockets alongside its usual open file descriptors. Silent no-op if the
# parent's hard limit is lower.
ulimit -n 65535 2>/dev/null || true

# We don't ship a paired log/run sidecar, so redirect stdout/stderr to a
# flat boot log; without this the agent's diagnostics would land on whatever
# the runit supervisor inherited (usually the boot console) and be lost.
# When/if a log/run + svlogd sidecar is packaged, drop this redirect.
exec /usr/local/bin/te-inventory-agent -config-file /etc/te-inventory-agent-config \
                                       -te-identity-file /var/lib/te-agent/identity.json \
                                       -te-config-file /etc/te-agent.cfg > /var/log/te-inventory-agent-boot.log 2>&1
