"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "advanced/Templates/pihole-FTL.service" between
pi-hole-5.3.1.tar.gz and pi-hole-5.4.tar.gz

About: Pi-hole is a DNS sinkhole that protects your devices from unwanted content like Internet advertisements, without installing any client-side software.

pihole-FTL.service  (pi-hole-5.3.1):pihole-FTL.service  (pi-hole-5.4)
#!/usr/bin/env bash #!/usr/bin/env sh
### BEGIN INIT INFO ### BEGIN INIT INFO
# Provides: pihole-FTL # Provides: pihole-FTL
# Required-Start: $remote_fs $syslog $network # Required-Start: $remote_fs $syslog $network
# Required-Stop: $remote_fs $syslog $network # Required-Stop: $remote_fs $syslog $network
# Default-Start: 2 3 4 5 # Default-Start: 2 3 4 5
# Default-Stop: 0 1 6 # Default-Stop: 0 1 6
# Short-Description: pihole-FTL daemon # Short-Description: pihole-FTL daemon
# Description: Enable service provided by pihole-FTL daemon # Description: Enable service provided by pihole-FTL daemon
### END INIT INFO ### END INIT INFO
FTLUSER=pihole
PIDFILE=/run/pihole-FTL.pid
is_running() { is_running() {
pgrep -o "pihole-FTL" > /dev/null 2>&1 pgrep -xo "pihole-FTL" > /dev/null
} }
# Start the service # Start the service
start() { start() {
if is_running; then if is_running; then
echo "pihole-FTL is already running" echo "pihole-FTL is already running"
else else
# Touch files to ensure they exist (create if non-existing, preserve if exis ting) # Touch files to ensure they exist (create if non-existing, preserve if exis ting)
touch /var/log/pihole-FTL.log /var/log/pihole.log mkdir -pm 0755 /run/pihole
touch /run/pihole-FTL.pid /run/pihole-FTL.port touch /run/pihole-FTL.pid /run/pihole-FTL.port /var/log/pihole-FTL.log /var/
touch /etc/pihole/dhcp.leases log/pihole.log /etc/pihole/dhcp.leases
mkdir -p /run/pihole
mkdir -p /var/log/pihole
chown pihole:pihole /run/pihole /var/log/pihole
# Remove possible leftovers from previous pihole-FTL processes
rm -f /dev/shm/FTL-* 2> /dev/null
rm /run/pihole/FTL.sock 2> /dev/null
# Ensure that permissions are set so that pihole-FTL can edit all necessary files # Ensure that permissions are set so that pihole-FTL can edit all necessary files
chown pihole:pihole /run/pihole-FTL.pid /run/pihole-FTL.port chown pihole:pihole /run/pihole-FTL.pid /run/pihole-FTL.port /var/log/pihole
chown pihole:pihole /etc/pihole /etc/pihole/dhcp.leases 2> /dev/null -FTL.log /var/log/pihole.log /etc/pihole/dhcp.leases /run/pihole /etc/pihole
chown pihole:pihole /var/log/pihole-FTL.log /var/log/pihole.log chmod 0644 /run/pihole-FTL.pid /run/pihole-FTL.port /var/log/pihole-FTL.log
chmod 0644 /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port /var/log/pihole.log /etc/pihole/dhcp.leases /etc/pihole/macvendor.db
/var/log/pihole.log
# Chown database files to the user FTL runs as. We ignore errors as the file s may not (yet) exist # Chown database files to the user FTL runs as. We ignore errors as the file s may not (yet) exist
chown pihole:pihole /etc/pihole/pihole-FTL.db /etc/pihole/gravity.db 2> /dev chown -f pihole:pihole /etc/pihole/pihole-FTL.db /etc/pihole/gravity.db /etc
/null /pihole/macvendor.db
if setcap CAP_NET_BIND_SERVICE,CAP_NET_RAW,CAP_NET_ADMIN,CAP_SYS_NICE+eip "$ if setcap CAP_NET_BIND_SERVICE,CAP_NET_RAW,CAP_NET_ADMIN,CAP_SYS_NICE,CAP_IP
(which pihole-FTL)"; then C_LOCK,CAP_CHOWN+eip "/usr/bin/pihole-FTL"; then
su -s /bin/sh -c "/usr/bin/pihole-FTL" "$FTLUSER" su -s /bin/sh -c "/usr/bin/pihole-FTL" pihole
else else
echo "Warning: Starting pihole-FTL as root because setting capabilities is not supported on this system" echo "Warning: Starting pihole-FTL as root because setting capabilities is not supported on this system"
pihole-FTL /usr/bin/pihole-FTL
fi fi
echo echo
fi fi
} }
# Stop the service # Stop the service
stop() { stop() {
if is_running; then if is_running; then
pkill -o pihole-FTL pkill -xo "pihole-FTL"
for i in {1..5}; do for i in 1 2 3 4 5; do
if ! is_running; then if ! is_running; then
break break
fi fi
echo -n "." printf "."
sleep 1 sleep 1
done done
echo echo
if is_running; then if is_running; then
echo "Not stopped; may still be shutting down or shutdown may have failed, killing now" echo "Not stopped; may still be shutting down or shutdown may have failed, killing now"
pkill -o -9 pihole-FTL pkill -xo -9 "pihole-FTL"
exit 1 exit 1
else else
echo "Stopped" echo "Stopped"
fi fi
else else
echo "Not running" echo "Not running"
fi fi
# Cleanup
rm -f /run/pihole/FTL.sock /dev/shm/FTL-*
echo echo
} }
# Indicate the service status # Indicate the service status
status() { status() {
if is_running; then if is_running; then
echo "[ ok ] pihole-FTL is running" echo "[ ok ] pihole-FTL is running"
exit 0 exit 0
else else
echo "[ ] pihole-FTL is not running" echo "[ ] pihole-FTL is not running"
skipping to change at line 102 skipping to change at line 92
stop stop
;; ;;
status) status)
status status
;; ;;
start|restart|reload|condrestart) start|restart|reload|condrestart)
stop stop
start start
;; ;;
*) *)
echo $"Usage: $0 {start|stop|restart|reload|status}" echo "Usage: $0 {start|stop|restart|reload|status}"
exit 1 exit 1
esac esac
exit 0 exit 0
 End of changes. 12 change blocks. 
30 lines changed or deleted 22 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)