OpenBSD 7.9, i686 / amd64
Application location: /opt/trigger_cl
Create the install directory, copy the binary and config.ini into it, and mark the executable runnable. The rc.d wrapper expects it exactly here.
doas mkdir -p /opt/trigger_cl
doas cp trigger_cl config.ini /opt/trigger_cl/
doas chmod +x /opt/trigger_cl/trigger_cl
Edit config.ini and fill in the [server] section. These two lines are the only required change before first start.
doas vi /opt/trigger_cl/config.ini
# in section [server] set
ip = trigger.itperfectservice.com
port = 9000
Export a per-host key file and print the matching key string. Both are needed to pair this machine with the mobile app.
doas /opt/trigger_cl/trigger_cl --export-bin /opt/trigger_cl/key.bin
doas /opt/trigger_cl/trigger_cl --show-key
Hand the key material to your phone: the binary file onto the device, the printed string into your account. From now on the phone can issue commands to this host.
key.bin to your Android device.KEY-XXXXXXXXXXXXX string — it identifies this host in the mobile UI.Write a tiny rc.d wrapper that calls rc_cmd and tells rc.subr to background the process. 555 permissions let root execute it without accidental writes.
doas tee /etc/rc.d/trigger_cl > /dev/null <<'EOF'
#!/bin/ksh
#
# OpenBSD rc.d wrapper for trigger_cl.
daemon="/opt/trigger_cl/trigger_cl"
daemon_flags=""
daemon_user="root"
rc_bg=YES
. /etc/rc.d/rc.subr
rc_cmd $1
EOF
doas chmod 555 /etc/rc.d/trigger_cl
rcctl enable records the service in rc.conf.local so it comes up at boot. rcctl start launches it right now.
doas rcctl enable trigger_cl
doas rcctl start trigger_cl
rcctl check reports the current state of the service. OpenBSD routes rc.d stdout/stderr to /var/log/daemon, so tail it to watch the client talk to the server.
doas rcctl check trigger_cl
doas tail -f /var/log/daemon