Compare commits
6 Commits
v4.3
...
fix/simpli
Author | SHA1 | Date | |
---|---|---|---|
|
eaaa0c1f7f | ||
|
cea9205136 | ||
|
0cc1e88608 | ||
|
1a741f696e | ||
|
b5af125be6 | ||
|
ecc49318f0 |
@@ -10,20 +10,14 @@
|
||||
### END INIT INFO
|
||||
|
||||
FTLUSER=pihole
|
||||
BINARY="/usr/bin/pihole-FTL"
|
||||
PIDFILE=/var/run/pihole-FTL.pid
|
||||
|
||||
get_pid() {
|
||||
pidof "pihole-FTL"
|
||||
}
|
||||
|
||||
is_running() {
|
||||
ps "$(get_pid)" > /dev/null 2>&1
|
||||
}
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
# Start the service
|
||||
start() {
|
||||
if is_running; then
|
||||
if pidofproc -p "${PIDFILE}" > /dev/null 2>&1; then
|
||||
echo "pihole-FTL is already running"
|
||||
else
|
||||
# Touch files to ensure they exist (create if non-existing, preserve if existing)
|
||||
@@ -43,10 +37,10 @@ start() {
|
||||
chmod 0644 /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port /var/log/pihole.log
|
||||
echo "nameserver 127.0.0.1" | /sbin/resolvconf -a lo.piholeFTL
|
||||
if setcap CAP_NET_BIND_SERVICE,CAP_NET_RAW,CAP_NET_ADMIN+eip "$(which pihole-FTL)"; then
|
||||
su -s /bin/sh -c "/usr/bin/pihole-FTL" "$FTLUSER"
|
||||
start_daemon -p "${PIDFILE}" /usr/bin/su -s /bin/sh -c "${BINARY} -f" "$FTLUSER" &
|
||||
else
|
||||
echo "Warning: Starting pihole-FTL as root because setting capabilities is not supported on this system"
|
||||
pihole-FTL
|
||||
start_daemon -p "${PIDFILE}" "${BINARY}" -f &
|
||||
fi
|
||||
echo
|
||||
fi
|
||||
@@ -54,11 +48,11 @@ start() {
|
||||
|
||||
# Stop the service
|
||||
stop() {
|
||||
if is_running; then
|
||||
if pidofproc -p "${PIDFILE}" > /dev/null 2>&1; then
|
||||
/sbin/resolvconf -d lo.piholeFTL
|
||||
kill "$(get_pid)"
|
||||
killproc -p "${PIDFILE}" "${BINARY}"
|
||||
for i in {1..5}; do
|
||||
if ! is_running; then
|
||||
if ! pidofproc -p "${PIDFILE}" > /dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
|
||||
@@ -67,9 +61,9 @@ stop() {
|
||||
done
|
||||
echo
|
||||
|
||||
if is_running; then
|
||||
if pidofproc -p "${PIDFILE}" > /dev/null 2>&1; then
|
||||
echo "Not stopped; may still be shutting down or shutdown may have failed, killing now"
|
||||
kill -9 "$(get_pid)"
|
||||
killproc -p "${PIDFILE}" "${BINARY}" 9
|
||||
exit 1
|
||||
else
|
||||
echo "Stopped"
|
||||
@@ -82,7 +76,7 @@ stop() {
|
||||
|
||||
# Indicate the service status
|
||||
status() {
|
||||
if is_running; then
|
||||
if pidofproc -p "${PIDFILE}" > /dev/null 2>&1; then
|
||||
echo "[ ok ] pihole-FTL is running"
|
||||
exit 0
|
||||
else
|
||||
|
@@ -44,9 +44,18 @@ static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
|
||||
compress.cache-dir = "/var/cache/lighttpd/compress/"
|
||||
compress.filetype = ( "application/javascript", "text/css", "text/html", "text/plain" )
|
||||
|
||||
mimetype.assign = ( ".png" => "image/png",
|
||||
".jpg" => "image/jpeg",
|
||||
".jpeg" => "image/jpeg",
|
||||
".html" => "text/html",
|
||||
".css" => "text/css; charset=utf-8",
|
||||
".js" => "application/javascript",
|
||||
".json" => "application/json",
|
||||
".txt" => "text/plain",
|
||||
".svg" => "image/svg+xml" )
|
||||
|
||||
# default listening port for IPv6 falls back to the IPv4 port
|
||||
include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
|
||||
include_shell "/usr/share/lighttpd/create-mime.assign.pl"
|
||||
|
||||
# Prevent Lighttpd from enabling Let's Encrypt SSL for every blocked domain
|
||||
#include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
|
||||
|
Reference in New Issue
Block a user