#!/bin/sh # Detached 9router launcher for @reboot cron. # Run as root crontab; drops privileges to user 'ubuntu' via runuser. # Uses absolute paths (cron @reboot has minimal PATH). SETSID=/usr/bin/setsid RUNUSER=/usr/sbin/runuser BIN=/usr/local/bin/9router USER=ubuntu LOG=/home/ubuntu/9router.log if [ "$(id -u)" -eq 0 ]; then exec $SETSID $RUNUSER -u $USER -- $BIN -t -n --host 127.0.0.1 --port 20128 >> "$LOG" 2>&1 < /dev/null else exec $SETSID $BIN -t -n --host 127.0.0.1 --port 20128 >> "$LOG" 2>&1 < /dev/null fi