Add 9router start-on-boot setup (non-root, @reboot cron, no systemd)
This commit is contained in:
32
install.sh
Executable file
32
install.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
# install.sh — set up 9router auto-start on boot (non-root, no systemd).
|
||||
# Run as root: sudo ./install.sh
|
||||
set -e
|
||||
|
||||
WRAPPER_SRC="./start-9router.sh"
|
||||
WRAPPER_DST="/usr/local/bin/start-9router.sh"
|
||||
LOG="/home/ardhi/9router.log"
|
||||
USER="ardhi"
|
||||
|
||||
echo "==> Installing wrapper to $WRAPPER_DST"
|
||||
install -m 0755 "$WRAPPER_SRC" "$WRAPPER_DST"
|
||||
|
||||
echo "==> Preparing log file ($LOG) owned by $USER"
|
||||
touch "$LOG"
|
||||
chown "$USER:$USER" "$LOG"
|
||||
chmod 644 "$LOG"
|
||||
|
||||
echo "==> Registering @reboot cron as ROOT"
|
||||
# Must be root's crontab (wrapper uses runuser to drop privileges).
|
||||
( crontab -l 2>/dev/null | grep -v 'start-9router.sh'; echo "@reboot $WRAPPER_DST" ) | crontab -
|
||||
|
||||
echo "==> Ensuring cron daemon is active"
|
||||
systemctl enable cron >/dev/null 2>&1 || true
|
||||
systemctl start cron >/dev/null 2>&1 || true
|
||||
|
||||
echo "==> Disabling broken systemd unit (if any)"
|
||||
systemctl disable 9router >/dev/null 2>&1 || true
|
||||
|
||||
echo "==> Done. Reboot to verify:"
|
||||
echo " ss -ltnp | grep 20128"
|
||||
echo " curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:20128/v1/models"
|
||||
Reference in New Issue
Block a user