Remove touch from runtime init scripts

co-authored-by: RD WebDesign <github@rdwebdesign.com.br>
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
This commit is contained in:
Dan Schaper 2022-04-01 11:45:16 -07:00
parent ecb0a8c87b
commit 54f56a717e
No known key found for this signature in database
GPG Key ID: 6055EE2AD4004FC0
2 changed files with 9 additions and 9 deletions

View File

@ -20,9 +20,9 @@ else
[[ -p /var/log/lighttpd/access.log ]] && rm -Rf /var/log/lighttpd/access.log
[[ -p /var/log/lighttpd/error.log ]] && rm -Rf /var/log/lighttpd/error.log
# Touch log files to ensure they exist (create if non-existing, preserve if existing)
[[ ! -f /var/log/lighttpd/access.log ]] && touch /var/log/lighttpd/access.log
[[ ! -f /var/log/lighttpd/error.log ]] && touch /var/log/lighttpd/error.log
# install /dev/null log files to ensure they exist (create if non-existing, preserve if existing)
[[ ! -f /var/log/lighttpd/access.log ]] && install /dev/null /var/log/lighttpd/access.log
[[ ! -f /var/log/lighttpd/error.log ]] && install /dev/null /var/log/lighttpd/error.log
# Ensure that permissions are set so that lighttpd can write to the logs
chown -R www-data:www-data /var/log/lighttpd

View File

@ -5,13 +5,13 @@ s6-echo "Starting pihole-FTL ($FTL_CMD) as ${DNSMASQ_USER}"
rm -f /dev/shm/FTL-* 2> /dev/null
rm /run/pihole/FTL.sock 2> /dev/null
# Touch files to ensure they exist (create if non-existing, preserve if existing)
# install /dev/null files to ensure they exist (create if non-existing, preserve if existing)
mkdir -pm 0755 /run/pihole
[[ ! -f /run/pihole-FTL.pid ]] && touch /run/pihole-FTL.pid
[[ ! -f /run/pihole-FTL.port ]] && touch /run/pihole-FTL.port
[[ ! -f /var/log/pihole-FTL.log ]] && touch /var/log/pihole-FTL.log
[[ ! -f /var/log/pihole.log ]] && touch /var/log/pihole.log
[[ ! -f /etc/pihole/dhcp.leases ]] && touch /etc/pihole/dhcp.leases
[[ ! -f /run/pihole-FTL.pid ]] && install /dev/null /run/pihole-FTL.pid
[[ ! -f /run/pihole-FTL.port ]] && install /dev/null /run/pihole-FTL.port
[[ ! -f /var/log/pihole-FTL.log ]] && install /dev/null /var/log/pihole-FTL.log
[[ ! -f /var/log/pihole.log ]] && install /dev/null /var/log/pihole.log
[[ ! -f /etc/pihole/dhcp.leases ]] && install /dev/null /etc/pihole/dhcp.leases
# 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 /var/log/pihole-FTL.log /var/log/pihole.log /etc/pihole/dhcp.leases /run/pihole /etc/pihole