Skip to content

Instantly share code, notes, and snippets.

@watercrossing
Last active September 24, 2022 17:28
Show Gist options
  • Select an option

  • Save watercrossing/25c44bb7a8c6aef3c3f31dba207019c9 to your computer and use it in GitHub Desktop.

Select an option

Save watercrossing/25c44bb7a8c6aef3c3f31dba207019c9 to your computer and use it in GitHub Desktop.
Pihole cron update script for custom paths
#!/usr/bin/env bash
# Pihole update script for pihole with custom admin path ready for cron.
if /usr/local/bin/pihole -up --check-only | grep -q 'Everything is up to date!'; then
exit 0;
fi
echo "Current versions"
/usr/local/bin/pihole -v
echo "Running update"
/usr/local/bin/pihole -up
echo "updating variables so that future updates will not fail"
#sed -i 's/\/var\/www\/pihole\/admin/\/var\/www\/pihole\/pihole-admin/g' /opt/pihole/*
sed -i 's/\/var\/www\/html\/admin/\/var\/www\/pihole\/pihole-admin/g' /opt/pihole/*
#grep -qxF 'webInterfaceDir=/var/www/pihole/pihole-admin' /etc/pihole/setupVars.conf || echo 'webInterfaceDir=/var/www/pihole/pihole-admin' >> /etc/pihole/setupVars.conf
#sed -i 's/\/var\/www\/html/\/var\/www\/pihole/g' /opt/pihole/*
echo "After update:"
/usr/local/bin/pihole -v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment