mirror of
https://github.com/andrey271192/Keenetic-Split-DNS.git
synced 2026-09-20 11:55:36 +00:00
40 lines
904 B
Bash
Executable File
40 lines
904 B
Bash
Executable File
#!/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
|