uzbek-plus/b12/router/router-common.sh

7 lines
401 B
Bash

# shellcheck shell=sh
. "$(dirname "$0")/router.conf"
now() { cut -d' ' -f1 /proc/uptime; }
log() { m="[$(now)] $*"; echo "$m"; mkdir -p $S; echo "$m" >> $S/router.log; }
bx() { _b=$1; shift; "$B/lib/ld-musl-aarch64.so.1" --library-path "$B/lib" "$B/sbin/$_b" "$@"; }
nft() { bx nft "$@"; }
dnsmasq_pid() { [ -f $S/dnsmasq.pid ] && kill -0 "$(cat $S/dnsmasq.pid)" 2>/dev/null && cat $S/dnsmasq.pid; }