1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-12-22 14:58:08 +00:00

Avoid a "No such file or directory" error

Check the file /etc/pihole/pihole-FTL.conf exists before trying to use
it.
without the patch I get, each day, in my logs:
sed: can't read /etc/pihole/pihole-FTL.conf: No such file or directory

I use a variable FTLconf to not repeat the file name twice.

Signed-off-by: Ludovic Rousseau <ludovic.rousseau@free.fr>
This commit is contained in:
Ludovic Rousseau 2018-04-13 11:08:02 +02:00
parent 3b229489c2
commit d8f85a8981

View File

@ -16,7 +16,8 @@ source ${colfile}
# Constructed to return nothing when
# a) the setting is not present in the config file, or
# b) the setting is commented out (e.g. "#DBFILE=...")
DBFILE="$(sed -n -e 's/^\s*DBFILE\s*=\s*//p' /etc/pihole/pihole-FTL.conf)"
FTLconf="/etc/pihole/pihole-FTL.conf"
[ -e "$FTLconf" ] && DBFILE="$(sed -n -e 's/^\s*DBFILE\s*=\s*//p' $FTLconf)"
# Test for empty string. Use standard path in this case.
if [ -z "$DBFILE" ]; then
DBFILE="/etc/pihole/pihole-FTL.db"