# Errors during weekly gravity.sh update (cron)

**URL:** <https://discourse.pi-hole.net/t/errors-during-weekly-gravity-sh-update-cron/805>\
**Category:** Help\
**Created:** [December 8, 2016, 11:09am UTC](https://discourse.pi-hole.net/t/errors-during-weekly-gravity-sh-update-cron/805 "2016-12-08T11:09:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jpgpi250](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/jpgpi250/32/286_2.png) [@jpgpi250](https://discourse.pi-hole.net/u/jpgpi250)\
**Post date:** [December 8, 2016, 11:09am UTC](https://discourse.pi-hole.net/t/errors-during-weekly-gravity-sh-update-cron/805/1 "2016-12-08T11:09:54Z")

</div>

I've enabled mail on my pi-hole (how to: [pi-hole installation on jessie-lite](http://users.telenet.be/MySQLplaylist/pi-hole.pdf))

The weekly cron job reports 3 errors (see below – bold)  
I’ve checked the script, the following modifications seem to fix the errors (/opt/.pihole/gravity.sh)

Line 32: whitelistScript="\*\*/etc/.pihole/\*\*pihole -w"  
Line 317: **/etc/.pihole** /pihole restartdns  
Line 353: **/etc/.pihole** /pihole status

-----Original Message-----  
To: root  
Subject: Cron [root@raspberrypi](mailto:root@raspberrypi) /usr/local/bin/pihole updateGravity

:::  
::: Neutrino emissions detected...  
:::  
::: Custom adList file detected. Reading... done!  
:::  
::: Getting raw.githubusercontent.com list... List updated, transport successful!  
::: Getting mirror1.malwaredomains.com list... List updated, transport successful!  
::: Getting sysctl.org list... No changes detected, transport skipped!  
::: Getting zeustracker.abuse.ch list... List updated, transport successful!  
::: Getting s3.amazonaws.com list... No changes detected, transport skipped!  
::: Getting s3.amazonaws.com list... No changes detected, transport skipped!  
::: Getting hosts-file.net list... List updated, transport successful!  
::: Getting raw.githubusercontent.com list... List updated, transport successful!  
::: Getting someonewhocares.org list... List updated, transport successful!  
::: Getting www.malwaredomainlist.com list... No changes detected, transport skipped!  
::: Getting winhelp2002.mvps.org list... No changes detected, transport skipped!  
::: Getting www.hosts-file.net list... No changes detected, transport skipped!  
::: Getting localhost list... No changes detected, transport skipped!  
:::  
::: Aggregating list of domains... done!  
::: Formatting list of domains to remove comments.... done!  
::: 640836 domains being pulled in by gravity...  
::: Removing duplicate domains.... done!  
::: 538707 unique domains trapped in the event horizon.  
:::  
::: Adding adlist sources to the whitelist... done!  
**/opt/pihole/gravity.sh: line 216: pihole: command not found**  
::: Whitelisting 13 domains... done!  
::: Nothing to blacklist!  
::: Formatting domains into a HOSTS file...  
:::  
::: Cleaning up un-needed files... done!  
:::  
::: Refresh lists in dnsmasq...  
**/opt/pihole/gravity.sh: line 317: pihole: command not found**  
**/opt/pihole/gravity.sh: line 353: pihole: command not found**

---

<div class="post-metadata">

**Author:** ![jacob.salmela](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/jacob.salmela/32/8_2.png) [@jacob.salmela](https://discourse.pi-hole.net/u/jacob.salmela)\
**Post date:** [December 10, 2016, 3:28pm UTC](https://discourse.pi-hole.net/t/errors-during-weekly-gravity-sh-update-cron/805/2 "2016-12-10T15:28:35Z")

</div>

I had one other user report this. I think it is only happening when running via `cron`. We'll take a look.

---

<div class="post-metadata">

**Author:** ![Mcat12](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/mcat12/32/20_2.png) [@Mcat12](https://discourse.pi-hole.net/u/Mcat12)\
**Post date:** [December 11, 2016, 8:07pm UTC](https://discourse.pi-hole.net/t/errors-during-weekly-gravity-sh-update-cron/805/3 "2016-12-11T20:07:11Z")

</div>

It is because root while running the cronjob doesn't have `pihole` on its path, so it can't execute it.

---

<div class="post-metadata">

**Author:** ![Adam](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/a/4af34b/32.png) [@Adam](https://discourse.pi-hole.net/u/Adam)\
**Post date:** [December 13, 2016, 7:19pm UTC](https://discourse.pi-hole.net/t/errors-during-weekly-gravity-sh-update-cron/805/4 "2016-12-13T19:19:23Z")

</div>

I am 'the other user' that Jacob referred to.

Indeed, root has nothing to rely on when running cron-jobs so the PATH has to either come from the crontab-file or from the script itself.

Seems like the daily script runs fine, the weekly script fails on every run.

---

<div class="post-metadata">

**Author:** ![DL6ER](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/dl6er/32/281_2.png) [@DL6ER](https://discourse.pi-hole.net/u/DL6ER)\
**Post date:** [December 14, 2016, 4:39pm UTC](https://discourse.pi-hole.net/t/errors-during-weekly-gravity-sh-update-cron/805/5 "2016-12-14T16:39:13Z")

</div>

See [Fix missing path information for cron by DL6ER · Pull Request #983 · pi-hole/pi-hole · GitHub](https://github.com/pi-hole/pi-hole/pull/983)

---

<div class="post-metadata">

**Author:** ![jpgpi250](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/jpgpi250/32/286_2.png) [@jpgpi250](https://discourse.pi-hole.net/u/jpgpi250)\
**Post date:** [December 14, 2016, 6:13pm UTC](https://discourse.pi-hole.net/t/errors-during-weekly-gravity-sh-update-cron/805/6 "2016-12-14T18:13:42Z")

</div>

did you also update update.sh?  
line 82: piholeVersion=$(/etc/.pihole/pihole -v -p -c)  
line 83: piholeVersionLatest=$(/etc/.pihole/pihole -v -p -l)  
line 85: webVersion=$(/etc/.pihole/pihole -v -a -c)  
line 86: webVersionLatest=$(/etc/.pihole/pihole -v -a -l)

see also [this](https://discourse.pi-hole.net/t/send-e-mail-or-notification-when-pihole-up-updates-pi-hole/563/2) topic (initially reported here)

---

<div class="post-metadata">

**Author:** ![DL6ER](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/dl6er/32/281_2.png) [@DL6ER](https://discourse.pi-hole.net/u/DL6ER)\
**Post date:** [December 14, 2016, 9:20pm UTC](https://discourse.pi-hole.net/t/errors-during-weekly-gravity-sh-update-cron/805/7 "2016-12-14T21:20:31Z")

</div>

@jpgpi250 I think this not necessary anymore, since the update also knows the [new path](https://github.com/pi-hole/pi-hole/pull/983/files#diff-7226f14b0a04e71c0d564cca889d7811R22)
