mirror of
https://github.com/andrey271192/Keenetic-Split-DNS.git
synced 2026-09-21 12:02:01 +00:00
Initial release: install, uninstall, SmartDNS, web UI
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
39
init.d/S99ksd-web
Executable file
39
init.d/S99ksd-web
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
# lighttpd web UI for Keenetic-Split-DNS
|
||||
|
||||
KSD_ETC="/opt/etc/keenetic-split-dns"
|
||||
CONF="${KSD_ETC}/lighttpd.conf"
|
||||
PIDFILE="/opt/var/run/keenetic-split-dns/lighttpd.pid"
|
||||
LOGDIR="/opt/var/log/keenetic-split-dns"
|
||||
|
||||
start() {
|
||||
mkdir -p "$LOGDIR" "$(dirname "$PIDFILE")"
|
||||
[ -f "$CONF" ] || return 1
|
||||
if [ -f "$PIDFILE" ] && kill -0 "$(cat "$PIDFILE" 2>/dev/null)" 2>/dev/null; then
|
||||
return 0
|
||||
fi
|
||||
lighttpd -f "$CONF" -m /opt/lib/lighttpd
|
||||
}
|
||||
|
||||
stop() {
|
||||
if [ -f "$PIDFILE" ]; then
|
||||
kill "$(cat "$PIDFILE" 2>/dev/null)" 2>/dev/null || true
|
||||
rm -f "$PIDFILE"
|
||||
fi
|
||||
killall lighttpd 2>/dev/null || true
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start) start ;;
|
||||
stop) stop ;;
|
||||
restart) stop; sleep 1; start ;;
|
||||
status)
|
||||
if [ -f "$PIDFILE" ] && kill -0 "$(cat "$PIDFILE" 2>/dev/null)" 2>/dev/null; then
|
||||
echo "lighttpd running"
|
||||
exit 0
|
||||
fi
|
||||
echo "lighttpd stopped"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
exit 0
|
||||
Reference in New Issue
Block a user