Files
Alpine_5G/etc/init.d/5g-router
nearxos 160ad641ce Add web GUI, docs, scripts, and 5G router config
- Web app (Flask): status, config, firewall, logs, users, restart
- Docs: AT commands, deploy, DNS, quickstart, web GUI
- Scripts: connect, deploy, diag, healthcheck, modem-status, speedtest, status, troubleshoot
- Init and iptables: 5g-router, 5g-webgui, rules.v4
- CHANGELOG, TODO, REVISION; config and README updates
2026-02-02 09:38:23 +02:00

46 lines
1.3 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/sbin/openrc-run
# Alpine 5G Router OpenRC service
# Start: run connect-5g.sh. Stop: bring down WAN interface (optional).
# Rev: 5 (see REVISION in repo root)
description="5G modem connection (connect-5g.sh)"
command="/usr/local/bin/connect-5g.sh"
command_background="yes"
output_log="/var/log/5g-router.log"
error_log="/var/log/5g-router.log"
pidfile="/run/5g-router.pid"
# connect-5g.sh runs run_once then sleep infinity so the process stays up; stop with service 5g-router stop
# Load config for WAN_IF if we need to clean up on stop
[ -f /etc/5g-router.conf ] && . /etc/5g-router.conf
WAN_IF="${WAN_IF:-eth1}"
depend() {
need net
after bootmisc
}
# Idempotent start: if already running, succeed instead of "already running" error
start() {
if [ -f "$pidfile" ] && kill -0 "$(cat "$pidfile")" 2>/dev/null; then
ebegin "Starting 5g-router"
eend 0 "Already running"
return 0
fi
ebegin "Starting 5g-router"
start-stop-daemon --start --background --pidfile "$pidfile" --make-pidfile \
--stdout "$output_log" --stderr "$error_log" \
--exec "$command"
eend $?
}
start_pre() {
return 0
}
stop_post() {
# Optionally bring down 5G interface so traffic uses other default route
ip link set "$WAN_IF" down 2>/dev/null || true
return 0
}